Install Oracle Database 12.1 and PostgreSQL 9.4 + PostGIS on Oracle Linux 7.4

Hey everyone,

I had to install an Oracle Linux 7.4 Server with a running Oracle Database 12.1 and PostgreSQL 9.4 + PostGIS. I will share my steps below.


Install Oracle Linux 7.4

  • Select “Agent for Hypervisor” during installation


[Optional if previous step is done] Install VMWareTools

  • From vSphere client mount source
  • From VM
# mount /dev/cdrom /mnt 
# cp /mnt/VMwareTools-8.6.17-3814316.tar.gz /tmp 
# tar -xvzf /mnt/VMwareTools-8.6.17-3814316.tar.gz 
# cd /tmp/vmware-tools-distrib/ 
# ./


Configure Network settings

# ip addr add dev ens160 
# route add default gw ens160 
# vi /etc/resolv.conf add  "nameserver nameserver" 
# vi /etc/hosts add "   servername.localdomain"


Update Yum and install Oracle Prerequisites

# yum update 
# yum install oracle-rdbms-server-12cR1-preinstall.x86_64

For Oracle Database 18c

yum install oracle-database-preinstall-18c

Set “oracle” account password

# passwd oracle


Set secure Linux to permissive

By editing the “/etc/selinux/config” file, making sure the SELINUX flag is set as follows “SELINUX=permissive

Once the change is complete, restart the server or run the following command

# setenforce permissive


Disable (or configure) firewall

# systemctl stop firewalld 
# systemctl disable firewalld


Add new Disk for Oracle Data from vSphere client

Reboot the VM or rescan SCSI bus manually

# echo "- - -" > /sys/class/scsi_host/host#/scan

Replace “#” by “0”,”1″, … Can be found by running

# ls /sys/class/scsi_host

Then check if the new Disk is visible

# fdisk -l


Create a new partition and format it or follow this link to create an LVM first.

# fdisk /dev/sdb

Select option “n” select “w” to write changes and exit

# mkfs.ext4 /dev/sdb1


Edit fstab

# vi /etc/fstab

Add “/dev/sdb1       /u01    ext4    defaults        1 2


Create “u01” directory, mount the new partition, create sub-folders structure and modify permissions and ownership

# mkdir u01 
# mount -a 
# mkdir -p /u01/app/oracle/product/ 
# chown -R oracle:oinstall /u01 
# chmod -R 775 /u01


Edit “/home/oracle/.bash_profile” file

# vi /home/oracle/.bash_profile

Add the following at the end of the file

# Oracle Settings

export TMP=/tmp 
export TMPDIR=$TMP
export ORACLE_HOSTNAME=servername.localdomain 
export ORACLE_UNQNAME=orcl 
export ORACLE_BASE=/u01/app/oracle 
export ORACLE_HOME=$ORACLE_BASE/product/ 
export ORACLE_SID=orcl
export PATH=/usr/sbin:$PATH 
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib 
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

Note : For the following steps to work, Xming should be installed and running. Putty should be configured to “Enable X11 Forwarding” and you have to login with oracle user directly from Putty
Upload “” and” to /tmp


Unzip the files

# cd /tmp 
# unzip 
# unzip


Install Oracle Database 12.1.02

# cd database
# ./runInstaller


Note : EM Url become https://servername.localdomain:5500/em


Set automatic DB startup for ORCL instance  

# vi /etc/oratab

Switch the “N” value to “Y” “orcl:/u01/app/oracle/product/



PostgreSQL install will come later.

Temp source:






Check PostgreSQL DB Status and start it

Connect trough SSH and run the following command, here related to PostgreSQL 9.3

# /sbin/service postgresql-9.3 status
postgresql-9.3 stopped
# /sbin/service postgresql-9.3 start
Start postgresql-9.3 : [ OK ]
# /sbin/service postgresql-9.3 status
postgresql-9.3 (pid 10393) is running...