YUM script
#!/bin/bash rm -rf /etc/yum.repos.d/* echo " [yum] name=yum baseurl=file:///mnt/ enabled=1 gpgcheck=0 " > /etc/yum.repos.d/yum.repo mount /dev/cdrom /mnt &> /dev/null yum clean all yum makecache
Oracle script
#!/bin/bash #配置ip: sed -i "s/ONBOOT=no/ONBOOT=yes/g" /etc/sysconfig/network-scripts/ifcfg-eth0 sed -i "s/BOOTPROTO=dhcp/BOOTPROTO=static/g" /etc/sysconfig/network-scripts/ifcfg-eth0 echo "IPADDR=172.16.1.1" >> /etc/sysconfig/network-scripts/ifcfg-eth0 echo "NETMASK=255.255.255.0" >>/etc/sysconfig/network-scripts/ifcfg-eth0 service network restart &> /dev/null #关闭Selinux: getenforce &> /dev/null #关闭防火墙: service iptables stop &> /dev/null #修改主机名: hostname oracle.com bash #域名解析: echo "172.16.1.1 oracle.benet.com" >> /etc/hosts #调整内核参数: echo "fs.aio-max-nr = 1048576" >>/etc/sysctl.conf echo "fs.file-max = 6815744" >>/etc/sysctl.conf echo "kernel.shmmni = 4096" >>/etc/sysctl.conf echo "kernel.sem = 250 32000 100 128" >>/etc/sysctl.conf echo "net.ipv4.ip_local_port_range = 9000 65500" >>/etc/sysctl.conf echo "net.core.rmem_default = 262144" >>/etc/sysctl.conf echo "net.core.rmem_max = 4194304" >>/etc/sysctl.conf echo "net.core.wmem_default = 262144" >>/etc/sysctl.conf echo "net.core.wmem_max = 1048586" >>/etc/sysctl.conf #准备系统软件环境: yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make numactl-devel sysstat unixODBC unixODBC-devel &> /dev/null rpm -e ksh &> /dev/null rpm -ivh pdksh-5.2.14-36.el5.i386.rpm &> /dev/null rpm -ivh ksh-20100202-1.el5.i386.rpm &> /dev/null mkdir -p /usr/share/fonts/zh_CN/TrueType unzip Oracle字体库zysong.zip &> /dev/null cp zysong.ttf /usr/share/fonts/zh_CN/TrueType/ #创建用户: groupadd -g 66 oinstall groupadd -g 77 oracle useradd -g oinstall -G oracle oracle echo ’123.com‘ | passwd --stdin oracle &> /dev/null #赋予权限: mkdir /opt/oracle chown -R oracle:oinstall /opt/oracle chmod -R 775 /opt/oracle #添加: echo 'umask 022' >>/home/oracle/.bash_profile echo 'export ORACLE_BASE=/opt/oracle' >>/home/oracle/.bash_profile echo 'export ORACLE_HOME=$ORACLE_BASE/product/11.2/db_1' >>/home/oracle/.bash_profile echo 'export ORACLE_SID=orcl' >>/home/oracle/.bash_profile echo 'export LANG=zh_CN.UTF-8' >>/home/oracle/.bash_profile echo 'export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"' >>/home/oracle/.bash_profile echo 'export PATH=$ORACLE_HOME/bin:$PATH' >>/home/oracle/.bash_profile echo "export DISPLAY=:0.0" >>/home/oracle/.bash_profile #资源限制: echo "session required /lib/security/pam_limits.so" >>/etc/pam.d/login echo "session required pam_limits.so" >>/etc/pam.d/login #资源限制: echo "oracle soft nproc 8192" >>/etc/security/limits.conf echo "oracle hard nproc 16384" >>/etc/security/limits.conf echo "oracle soft nofile 32768" >>/etc/security/limits.conf echo "oracle hard nofile 65536" >>/etc/security/limits.conf echo "oracle soft stack 10240" >>/etc/security/limits.conf
mkdir /mnts
mount /dev/cdrom1 /mnts mkdir /database cp -r /mnts/* /database/ xhost + &> /dev/null xhost + &> /dev/null su - oracle cd /database/ ./runInstaller
安装两个光盘
centos6.5挂载到/mnt下
Oracle挂载到自定义的/mnts下
注意第一次挂载的事cdrom,第二个是cdrom2
oracle.sh脚本注:执行完成脚本 须重新启动虚拟机
重启之后在root界面重新执行xhost + ,否则会报错