11gR2 Preinstallation Operations On RHEL5.8 64bit Only

#!/bin/sh
#Theme:  11gR2 Preinstallation Operations On RHEL5.8 64bit Only
#Author: Majesty.
#MyBlog: http://majesty.blog.51cto.com  for more research about oracle.

#Forward
#  referencing http://docs.oracle.com/cd/E11882_01/install.112/e24324/toc.htm
#  and some internet resource.

#Before Anything:
#  If you assure you install all os packages already, you could skip this step.
#  You had batter mount RHEL5.8 64bit on /mnt

#Main Dir
#  #1 add essential user and group for O11gR2 installation.
#  #2 modify ~/.bash_profile
#  #3 modify /etc/sysctl.conf
#  #4 modify /etc/security/limits.conf
#  #5 /etc/profile
#  #6 /etc/pam.d/login
#  #7 install essential os packages for oracle installation.
 
#set -x
#assure you already configure the yum
#1 add essential user and group for O11gR2 installation.
groupadd dba
groupadd oper
groupadd oinstall
useradd oracle
usermod -g oinstall -G dba oracle
passwd oracle <<EOF
oracle
EOF
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app

#2 modify ~/.bash_profile
cat > /home/oracle/.bash_profile <<'EOF'
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.3/db_1
export ORACLE_SID=ocm11g
export ORACLE_UNQNAME=ocm11g
export ORACLE_OWNER=oracle
export ORACLE_TERM=vt100
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib
export PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
export PATH=$PATH:/usr/sbin:/usr/bin;
export NLS_LANG=american_america.AL32UTF8
export LANG=en_US
export EDITOR=vim
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"
EOF


#3 modify /etc/sysctl.conf
cat > /etc/sysctl.conf <<EOF
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
 ###kernel.shmmax>=half of your memory
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
EOF


#4 modify /etc/security/limits.conf
# It is the resource limit for the number of processes available to a user.
cat > /etc/security/limits.conf  <<EOF
oracle soft nproc  20470
oracle hard nproc  20480
oracle soft nofile 20480
oracle hard nofile 65536
oracle soft stack  20480
EOF

#5 /etc/profile
check_profile=`grep "ulimit -p 16384" /etc/profile`
if [ "$check_profile" == ''  ]; then
cat >> /etc/profile <<EOF
if [ $USER = "oracle" ]; then
  if [ $SHELL = "/bin/ksh" ]; then
     ulimit -p 16384
     ulimit -n 65536
  else
     ulimit -u 16384 -n 65536
  fi
fi
EOF
else
  echo "Negative........../etc/profile ware already modified!!"
fi
 
#6 /etc/pam.d/login
check_pam=`grep "/lib/security/pam_limits.so" /etc/pam.d/login | awk {'print $3'}`
if [ $? = 0 ];
then
    echo "Negative........../etc/pam.d/login ware already modified!!"
else
cat >> /etc/pam.d/login <<!
session required /lib/security/pam_limits.so
session required pam_limits.so
!
fi


#please mount RHEL5 cdrom to /mnt directory!!!
#7 install essential os packages for oracle installation.
cat > /etc/yum.repos.d/base.repo <<EXX
[server]
name=server
baseurl=file:/mnt/Server
gpgcheck=0
enabled=1
EXX

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
cd  /mnt/Server
rpm -ivh                yum*
yum -y localinstall     binutil*
yum -y localinstall     compat-libstdc++*
yum -y localinstall     elfutils-libelf*
yum -y localinstall     elfutils-libelf-devel*
yum -y localinstall     elfutils-libelf-devel-static*
yum -y localinstall     gcc*
yum -y localinstall     gcc-c++*
yum -y localinstall     glibc*
yum -y localinstall     glibc-common*
yum -y localinstall     glibc-devel*
yum -y localinstall     glibc-headers*
yum -y localinstall     kernel-headers*
yum -y localinstall     ksh*
yum -y localinstall     libaio*
yum -y localinstall     libgcc*
yum -y localinstall     libgomp*
yum -y localinstall     libstdc++*
yum -y localinstall     libstdc++*
yum -y localinstall     make*
yum -y localinstall     sysstat*

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章