Preparing RHEL 6 server for Oracle 11gR2 database installation

Jephe Wu - http://linuxtechres.blogspot.com

Objective:  step-by-step to install a RHEL 6.4/6.5 64bit server VM on ESXi 5 for preparing Oracle database installation
Environment: ESXi 5, vsphere client, RHEL 6.4 64bit, Oracle 11gR2 database single instance installation



Steps

1.  Information 
hostname: oradb1
ip: 192.168.1.2/24
virtual disk size: 80g
vcpu: 2
RAM: 4G
partition: / - 20g , swap - 4g, /boot - 500M, /u01 - the rest
use LVM for everything except for /boot.

2. Installation
download RHEL 6.4/6.5 x86_64bit DVD, upload to ESXi datastore through Vsphere.
create a new VM with the datastore, choose this uploaded iso file and connect it and power it on so it will boot from dvd for OS installation

3. Package selection
Just choose 'Base' which is default option to install it, also tick ' Compatibility libraries'.

4. Configuration after OS installation
a. disable selinux , vi /etc/sysconfig/selinux
b. ntsysv --level 2345 to disable unnecessary services
c. vi /etc/sysconfig/network-scripts/ifcfg-eth0, change onboot=yes if required.
d. run 'setup' to setup network eth0 if required.

4. setup yum repo for dvd media
Later on, you need to manually install quite a lot of rpms, in order to auto resolve the dependency, you can setup a yum repo based on dvd itself

cd /etc/yum.repos.d
cp rhel-source.repo rhel64.repo -va
vi rhel64.repo as follows:

[oracle@oradb1 yum.repos.d]$ more rhel64.repo 
[rhel64]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file:///media/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

From ESxi VM, hardware, for cdrom/dvd, tick 'connected' and 'connect at poweron' to connect dvd, then mount it as follows:
mount /dev/dvd /media

5. Preparing package for Oracle database
Requirements for Installing Oracle 11gR2 RDBMS on RHEL6 or OL6 64-bit (x86-64) (Doc ID 1441282.1) , the following packages are required.

yum install tigervnc-server xterm xorg-x11-twm   # for vnc work to install database
yum install tigervnc-server xterm ksh gcc gcc-c++ libaio-devel unixODBC unixODBC.i686 elfutils-libelf-devel  # required by Oracle 
yum install mksh  #replace pdksh, ignore all when installing Oracle database
https://access.redhat.com/site/solutions/66816   -  Installation of Oracle fails with Missing Requisite File "pdksh-5.2.14" in Red Hat Enterprise Linux 6 ?

6. vi /etc/hosts to add line as follows:
192.168.1.2   oradb1
7. Create Oracle users and groups
groupadd -g 501 oinstall
groupadd -g 502 dba
groupadd -g 503 oper
useradd -m -u 501 -g oinstall -G dba,oper -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01/app
chmod -R 775 /u01/app

8. sysctl.conf
append the following to the end of file /etc/sysctl.conf
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
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
To activate these new settings into the running kernel space, run the "sysctl -p" command as root.
9. shell limit conf

       a.) Add the following settings to /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240

  b.) Verify the latest version of PAM is loaded, then add or edit the following line in the /etc/pam.d/login file, if it does not already exist:
session required pam_limits.so

Note: not required for RHEL 6.4 as it's already put in system-auth, refer to the reference part at the bottom of this page for RHEL6 best practice for Oracle 11g R2 database

       c.) Verify the current ulimits, and raise if needed.  This can be done many ways...adding the following lines to /etc/profile is the recommended method:
if [ $USER = "oracle" ]; then
    if [ $SHELL = "/bin/ksh" ]; then
       ulimit -u 16384
       ulimit -n 65536
    else
       ulimit -u 16384 -n 65536
    fi
fi

10. Oracle home .bash_profile set
append the following
JAVA_HOME=/usr/local/java; export JAVA_HOME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
PATH=$PATH:$ORACLE_HOME/bin

11. preparing database installation
ssh into server as oracle user, run 'vncserver', 
then at client side, use vncviewer to connect to it as default port 5901. You can also use SSH tunnel for vnc port forwarding.

12.  copy Oracle db software 2 of 7 zip files to /home/oracle/softwares (create softwares first) , modify the CV_ASSUME_DISTID as follows, then run './runInstaller'.

Edit the cvu_config file as follows:
sed -i 's/CV_ASSUME_DISTID=OEL4/CV_ASSUME_DISTID=OEL6/' 
/u01/app/oracle/oracle-software/database/stage/cvu/cv/admin/cvu_config


13. run 'netca' to create listener

14. run 'dbca' to create database and dbconsole.