--------------------------------------------------------------------------------
-- OS configuration
-- execute as root
--------------------------------------------------------------------------------

-- create group

/usr/sbin/groupadd -g 1521 dba

-- create user

/usr/sbin/useradd -u 1521 -g dba -G dba oracle

-- change password

passwd oracle

--------------------------------------------------------------------------------

-- add kernel parameters for oracle 12c to /etc/sysctl.conf

fs.aio-max-nr = 1048576
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
net.ipv4.ip_local_port_range = 9000 65500

-- apply kernel parameters

/sbin/sysctl -p

--------------------------------------------------------------------------------

-- set shell limits for user oracle in file /etc/security/limits.conf

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

--------------------------------------------------------------------------------

-- /etc/hosts file must contain a fully qualified name for the server

hostname

db01-s

cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 db01-s
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.8.1 db01-s

--------------------------------------------------------------------------------

-- secure linux must be disabled

cat /etc/selinux/config

SELINUX=disabled
SELINUXTYPE=targeted

--------------------------------------------------------------------------------

-- check installed linux packages for oracle 12c

rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}(%{ARCH})\n' binutils \
compat-libcap1 \
compat-libstdc++-33 \
glibc \
glibc-devel \
ksh \
libaio \
libaio-devel \
libX11 \
libXau \
libXi \
libXtst \
libgcc \
libstdc++ \
libstdc++-devel \
libxcb \
make \
nfs-utils \
smartmontools \
net-tools \
sysstat

-- output can be something like this:

binutils-2.27-41.base.el7_7.1(x86_64)
compat-libcap1-1.10-7.el7(x86_64)
compat-libstdc++-33-3.2.3-72.el7(x86_64)
glibc-2.17-292.el7(x86_64)
glibc-devel-2.17-292.el7(x86_64)
ksh-20120801-139.el7(x86_64)
libaio-0.3.109-13.el7(x86_64)
libaio-devel-0.3.109-13.el7(x86_64)
libX11-1.6.7-2.el7(x86_64)
libXau-1.0.8-2.1.el7(x86_64)
libXi-1.7.9-1.el7(x86_64)
libXtst-1.2.3-1.el7(x86_64)
libgcc-4.8.5-39.el7(x86_64)
libstdc++-4.8.5-39.el7(x86_64)
libstdc++-devel-4.8.5-39.el7(x86_64)
libxcb-1.13-1.el7(x86_64)
make-3.82-24.el7(x86_64)
package nfs-utils is not installed
smartmontools-7.0-1.el7(x86_64)
net-tools-2.0-0.25.20131004git.el7(x86_64)
sysstat-10.1.5-18.el7(x86_64)

-- install missing packages

yum -y install nfs-utils

--------------------------------------------------------------------------------

-- create directory structure

mkdir /data/oracle
chown oracle:dba /data/oracle

mkdir /data/oraInventory
chown oracle:dba /data/oraInventory

--------------------------------------------------------------------------------
-- install database software
-- execute as oracle
--------------------------------------------------------------------------------

su - oracle

-- create oracle home directory

export ORACLE_BASE=/data/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1
export ORA_INVENTORY=/data/oraInventory

mkdir -p ${ORACLE_HOME}

--------------------------------------------------------------------------------

-- download oracle 12c database software (release 12.2.0.1) for linux on x64 architecture (64 bits)

linuxx64_12201_database.zip

-- copy software to some install directory e.g.

/data/oracle/install/

-- unzip software

cd /data/oracle/install/

unzip linuxx64_12201_database.zip

-- unzip created directory database, go there

cd database

-- run silent installation from install directory

./runInstaller -ignorePrereq -waitforcompletion -silent                    \
    -responseFile /data/oracle/install/database/response/db_install.rsp    \
    oracle.install.option=INSTALL_DB_SWONLY                                \
    ORACLE_HOSTNAME=${ORACLE_HOSTNAME}                                     \
    UNIX_GROUP_NAME=dba                                                    \
    INVENTORY_LOCATION=${ORA_INVENTORY}                                    \
    SELECTED_LANGUAGES=en,en_GB                                            \
    ORACLE_HOME=${ORACLE_HOME}                                             \
    ORACLE_BASE=${ORACLE_BASE}                                             \
    oracle.install.db.InstallEdition=EE                                    \
    oracle.install.db.OSDBA_GROUP=dba                                      \
    oracle.install.db.OSBACKUPDBA_GROUP=dba                                \
    oracle.install.db.OSDGDBA_GROUP=dba                                    \
    oracle.install.db.OSKMDBA_GROUP=dba                                    \
    oracle.install.db.OSRACDBA_GROUP=dba                                   \
    oracle.install.db.OSOPER_GROUP=dba                                     \
    SECURITY_UPDATES_VIA_MYORACLESUPPORT=false                             \
    DECLINE_SECURITY_UPDATES=true


Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.   Actual 44351 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 24575 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2020-03-01_10-47-32PM. Please wait ...You can find the log of this install session at:
 /data/oraInventory/logs/installActions2020-03-01_10-47-32PM.log
The installation of Oracle Database 12c was successful.
Please check '/data/oraInventory/logs/silentInstall2020-03-01_10-47-32PM.log' for more details.

As a root user, execute the following script(s):
        1. /data/oraInventory/orainstRoot.sh
        2. /data/oracle/product/12.2.0/dbhome_1/root.sh

Successfully Setup Software.

--------------------------------------------------------------------------------
-- login as a root user and run the scripts:
--------------------------------------------------------------------------------

[root@db01-s ~]# /data/oraInventory/orainstRoot.sh

Changing permissions of /data/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /data/oraInventory to dba.
The execution of the script is complete.

[root@db01-s ~]# /data/oracle/product/12.2.0/dbhome_1/root.sh

Check /data/oracle/product/12.2.0/dbhome_1/install/root_db01-s_2020-03-02_09-35-35-519786914.log for the output of root script

--------------------------------------------------------------------------------
-- modify .bash_profile for user oracle in his home directory /home/oracle
--------------------------------------------------------------------------------

# .bash_profile

# User specific environment and startup programs

export ORACLE_BASE=/data/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1

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

export ORA_INVENTORY=/data/oraInventory
export ORACLE_HOSTNAME=db01-s
export ORACLE_UNQNAME=testdb01
export ORACLE_SID=testdb01

export TZ=Europe/Amsterdam
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export NLS_DATE_FORMAT="dd-mm-yyyy hh24:mi:ss"
export ORACLE_TERM=vt100

alias lh='ls -alh'
alias dfh='df -h | sort'
alias cdob='cd $ORACLE_BASE'
alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORA'

umask 022

--------------------------------------------------------------------------------