Install oracle server v2

###########################
## INSTALLATION SILENT MODE
###########################
yum update

vim /etc/hosts
<IP-address>  <fully-qualified-machine-name>  <machine-name>

#groups for database management
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

useradd -u 54321 -g oinstall -G dba,oper,backupdba,dgdba,kmdba oracle
passwd oracle

# install packages dependencies

vim /etc/sysctl.conf
>>>
--kernel parameters for 12gR1 installation

fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
>>>

/sbin/sysctl -p

vim /etc/security/limits.conf
>>>
--shell limits for users oracle 12gR1

oracle   soft   nofile   1024
oracle   hard   nofile   65536
oracle   soft   nproc    2047
oracle   hard   nproc    16384
oracle   soft   stack    10240
oracle   hard   stack    32768
>>>

# Bash profile for oracle user
vim /home/oracle/.bash_profile
>>>
# Oracle Settings
export TMP=/tmp

export ORACLE_HOSTNAME= [oel6.dbaora.com](http://oel6.dbaora.com) 
export ORACLE_UNQNAME=ORA12C
export ORACLE_BASE=/ora01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1
export ORACLE_SID=ORA12C

PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;

alias cdob='cd $ORACLE_BASE'
alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

envo
>>>

# Directory structure
mkdir -p /ora01/app/oracle/product/12.1.0/db_1
chown oracle:oinstall -R /ora01

# Setting selinux permissive
vim  /etc/selinux/config
>>>
SELINUX=permissive
setenforce Permissive
>>>

# Disable firewall
service iptables stop
chkconfig iptables off

# From now, use oracle user and set response files
./runInstaller -silent -responseFile /home/oracle/database/response/db_install.rsp
sqlplus / as sysdba

netca -silent -responseFile /home/oracle/database/response/netca.rsp
lsnrctl status

mkdir /ora01/app/oracle/oradata
mkdir /ora01/app/oracle/flash_recovery_area
dbca -silent -responseFile /home/oracle/database/response/dbca.rsp

# Verifying
sqlplus / as sysdba
show parameter db_name
show con_id
show con_name
select DBMS_XDB_CONFIG.GETHTTPSPORT from dual;

# Set ORA12C to Y
vim /etc/oratab
>>>
ORA12C:/ora01/app/oracle/product/12.1.0/db_1:Y
>>>



#######################
###  INSTALLATION
#######################
ip a   | grep inet  # set ip address

# add required groups
/usr/sbin/groupadd -g 501 oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/groupadd -g 503 oper

# oracle user
/usr/sbin/useradd -u 502 -g oinstall -G dba,oper oracle
passwd oracle

# Kernel configurations
vim /etc/sysctl.conf
>>>
kernel.shmmni = 4096
kernel.shmmax = 4398046511104
kernel.shmall = 1073741824
kernel.sem = 250 32000 100 128
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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 = 1048586
>>>

# apply changes
/sbin/sysctl -p

# shell limits
vim /etc/security/limits.conf
>>>
oracle   soft   nproc    131072
oracle   hard   nproc    131072
oracle   soft   nofile   131072
oracle   hard   nofile   131072
oracle   soft   core     unlimited
oracle   hard   core     unlimited
oracle   soft   memlock  50000000
oracle   hard   memlock  50000000
>>>

# update oracle bash profile
vim /home/oracle/.bash_profile
>>>
#Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=O7-unixmen
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
>>>

# required packages
yum groupinstall "GNOME Desktop" -y
yum groupinstall "Development Tools" -y

yum install binutils -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y
yum install zlib-devel -y

# set directory
mkdir -p   /u01/app/oracle/product/12.1.0
chown  -R oracle:oinstall /u01/
chmod  775 /u01/app

# disable selinux
vim /etc/selinux/config
SELINUX=permissive

# install oracle
su - oracle
unzip linuxamd64_12c_database_1of2.zip
unzip linuxamd64_12c_database_2of2.zip 
cd database
./runInstaller

# with GUI 
yum groupinstall "GNOME Desktop" -y
xhost + # as root.
export DISPLAY=:0.0 # as oracle


# After installation
vi /etc/oratab
orcl:/u01/app/oracle/product/12.1.0/db_1:Y

# testing commands
lsnrctl
LSNRCTL> status

# starting oracle service
dbstart /u01/app/oracle/product/12.1.0/db_1
dbstart `echo $ORACLE_HOME`

$ sqlplus /nolog
SQL> connect / as sysdba
SQL> startup