- #!/bin/bash -x
- # used for install oracle
- # ctime: 2012/11/05
- # tun kernel
- echo 'fs.file-max = 6815744
- kernel.shmall = 2097152
- kernel.shmmax = 2147483648
- kernel.shmmni = 4096
- kernel.sem = 250 32000 100 128
- fs.aio-max-nr = 1048576
- net.ipv4.ip_local_port_range = 9000 65500
- net.core.rmem_default = 4194304
- net.core.rmem_max = 4194304
- net.core.wmem_default = 262144
- net.core.wmem_max = 1048576 ' >> /etc/sysctl.conf
- # tun file max
- echo 'oracle soft nproc 2047
- oracle hard nproc 16384
- oracle soft nofile 10000
- oracle hard nofile 65536 ' >> /etc/security/limits.conf
- # tun pam
- echo 'session required /lib/security/pam_limits.so' >> /etc/pam.d/login
- # install packge
- read -p "Make sure your yum is works. (yes/no): " ask
- if [ "$ask" = "yes" ] || [ "$ask" = "y" ] || [ "$ask" = "YES" ];then
- yum install -y compat-libstdc++* libaio-devel sysstat unixODBC-devel unixODBC unixODBC-libs pdksh
- yum grouplist | grep "X Window System" > /dev/null
- if [ "$?" = "0" ];then
- yum groupinstall -y "X Window System" "Development Tools" "Development Libraries"
- fi
- else
- echo "Sorry,you yum is note work. Please check"
- exit 10
- fi
- ~
- # create oracle group and user
- grep oinstall /etc/group ||groupadd oinstall
- grep dba /etc/group || groupadd dba
- useradd -g oinstall -G dba oracle
- echo "redhat" | passwd --stdin oracle
- # make oracle install dir
- mkdir -p /u01/app
- chown oracle:oinstall /u01 -R
- # add oracle env
- echo 'ORACLE_SID=oralab
- ORACLE_BASE=/u01/app
- ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
- export ORACLE_SID ORACLE_BASE ORACLE_HOME' >> /home/oracle/.bash_profile
- source /home/oracle/.bash_profile
- source /etc/profile
- sysctl -p
- #used for vnc
- echo 'VNCSERVERS="1:oracle"
- VNCSERVERARGS[1]="-geometry 800x600" ' >> /etc/sysconfig/vncservers
- echo "Now you can use "vncpasswd " set your vnc password"
- echo "And you can use "vncserver" start your vnc server"
- #iptables and selinux
- iptables -X
- iptables -Z
- iptables -F
- service iptables save
- chkconfig iptables off
- sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config