#!/bin/bash ###the script to install oracle10g on rhel5!! ##show notes! echo -ne the script is writed by xtao@sinoinfo!\n spath=/public/sourcecode oracle_base=/u01/app/oracle oracle_sid=orcl ##edit the /etc/sysctl.conf ! echo -e '\n' echo
#!/bin/bash
###the script to install oracle10g on rhel5!!
##show notes!
echo -ne the script is writed by xtao@sinoinfo!\n
spath=/public/sourcecode
oracle_base=/u01/app/oracle
oracle_sid=orcl
##edit the /etc/sysctl.conf !
echo -e '\n'
echo -en '\e[31m modify the /etc/sysctl.conf ! \e[0m \n'
cp /etc/sysctl.conf /etc/sugon.bak.sysctl.conf
if [ $? != 0 ];then
echo backup sysctl.conf failed
exit -1
fi
cat > /etc/sysctl.conf
kernel.shmall = 4194304
kernel.shmmax = 17179869184
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 1048576
net.core.wmem_max = 1048576
eof
if [ $? != 0 ];then
echo modify sysctl.conf failed
exit -1
fi
##login as root and issue the following command:
echo -e '\n'
echo -en '\e[31m add the xhost ! \e[0m \n'
xhost +$hostname
##edit the /etc/redhat-release file replacing the current release information (red hat enterprise linux server release 5 (tikanga)) with the following:
echo -e '\n'
echo -en '\e[31m change the releas to rhel4 ! \e[0m \n'
cp /etc/redhat-release /etc/sugon.bak.redhat-release
echo -n redhat-4 > /etc/redhat-release
##run the following command to change the current kernel parameters:
echo -e '\n'
echo -en '\e[31m display the sysctl information ! \e[0m \n'
/sbin/sysctl -p
if [ $? != 0 ];then
echo update sysctl failed
exit -1
fi
##add the following lines to the /etc/security/limits.conf file:
echo -e '\n'
echo -en '\e[31m modify the /etc/security/limits.conf ! \e[0m \n'
cp /etc/security/limits.conf /etc/security/sugon.bak.limits.conf
if [ $? != 0 ];then
echo backup limits.conf failed
exit -1
fi
cat > /etc/security/limits.conf
* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536
eof
if [ $? != 0 ];then
echo modify limits.conf failed
exit -1
fi
##add the following line to the /etc/pam.d/login file, if it does not already exist:
echo -e '\n'
echo -en '\e[31m modify the /etc/pam.d/login ! \e[0m \n'
cp /etc/pam.d/login /etc/pam.d/sugon.bak.login &&
if [ $? != 0 ];then
echo backup pam.d-login failed
exit -1
fi
echo -n session required pam_limits.so >> /etc/pam.d/login &&
if [ $? != 0 ];then
echo modify pam.d-login failed
exit -1
fi
##disable secure linux by editing the /etc/selinux/config file, making sure the selinux flag is set as follows:
echo -e '\n'
echo -en '\e[31m disable the selinux ! \e[0m \n'
cp /etc/selinux/config /etc/selinux/sugon.bak.config &&
if [ $? != 0 ];then
echo backup selinux.config failed
exit -1
fi
echo -n selinux=disabled > /etc/selinux/config &&
if [ $? != 0 ];then
echo modify selinux failed
exit -1
fi
##create the new groups and users:
echo -e '\n'
echo -en '\e[31m create the user and group for install ! \e[0m \n'
groupadd oinstall &&
groupadd dba &&
groupadd oper &&
useradd -g oinstall -g dba oracle &&
echo 11111 | passwd oracle --stdin
##create the directories in which the oracle software will be installed:
echo -e '\n'
echo -en '\e[31m create the dir for oracle_base and chown the privilege! \e[0m \n'
mkdir -p $oracle_base/product/10.2.0/db_1 &&
chown -r oracle.oinstall /u01 &&
##login as the oracle user and add the following lines at the end of the .bash_profile file:
echo -e '\n'
echo -en '\e[31m modify the bash_profile of oracle ! \e[0m \n'
cat > /home/oracle/.bash_profile
export oracle_base=/u01/app/oracle
export oracle_home=$oracle_base/product/10.2.0/db_1
export ora_crs_home=/u01/crs/oracle/10gr2/crs
export oracle_sid=orcl
export tns_admin=$oracle_home/network/admin
export path=$oracle_home/bin:$home/bin:$ora_crs_home/bin:/sbin:$ora_asm_home:$path
eof