Here we are installing PostgreSQL on an Oracle  VirtualBox RH 7 to demonstrate the process.

You should have :

  • Installed RedHat 7
  • The VBox host should have two network connects.
  • The first should be a “Bridged Adapter”, the second a “Hosts-only Adapter”.

I set both up with Promiscuous Mode = “Allow All”

N.B. all the security disabling etc is because this is a test installation.


Helpful PostgreSQL wiki


Prepare RedHat

Stop redhat from resolving PostgreSQL dependencies to the base repository rather than the version we want to use.

# vi /etc/yum/pluginconf.d/rhnplugin.conf


List the installed postgresql software

# yum list installed | grep stgre

Remove the default installation

# yum remove postgresql.x86_64


Install PostgreSQL

Install the 9.6 postgresql software

# yum install

# yum install postgresql96-server postgresql96-contrib


Initialise the postgresql installation

# /usr/pgsql-9.6/bin/postgresql96-setup initdb

Enable postgresql startup on reboot

# systemctl enable postgresql-9.6

Start postgresql
# systemctl start postgresql-9.6

Ensure SELINUX is disabled

# vi /etc/selinux/config
set to disabled

For this testing on an Oracle  VirtualBox RH 7  we will disable the firewall as well

# systemctl disable firewalld

# systemctl stop firewalld


Remove the installation

yum erase postgresql96*




Can’t find the yum packages ?

Browse to get the version of PostgreSQL you want.

We will stick with pgdg-redhat96-9.6-3.noarch.rpm so we don’t run into any new version issues.

yum install


download an install via rpm -Upv pgdg-redhat96-9.6-3.noarch.rpm

Install PostgreSQL Server

[root@RH72 Downloads]# yum list postgresql*
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Installed Packages
postgresql.x86_64 9.2.18-1.el7 @anaconda/7.3
postgresql-docs.x86_64 9.2.18-1.el7 @anaconda/7.3
postgresql-libs.x86_64 9.2.18-1.el7 @anaconda/7.3
postgresql-server.x86_64 9.2.18-1.el7 @anaconda/7.3
Available Packages
postgresql-jdbc.noarch 42.1.4-1.rhel7 pgdg96
postgresql-jdbc-javadoc.noarch 42.1.4-1.rhel7 pgdg96
postgresql-pgpool-II.x86_64 3.4.6-1.el7 epel
postgresql-pgpool-II-devel.x86_64 3.4.6-1.el7 epel
postgresql-pgpool-II-extensions.x86_64 3.4.6-1.el7 epel
postgresql-plruby.x86_64 0.5.3-13.el7 epel
postgresql-plruby-doc.x86_64 0.5.3-13.el7 epel
postgresql-unit96.x86_64 3.1-1.rhel7 pgdg96
postgresql-unit96-debuginfo.x86_64 3.1-1.rhel7 pgdg96
postgresql96.x86_64 9.6.4-1PGDG.rhel7 pgdg96
postgresql96-contrib.x86_64 9.6.4-1PGDG.rhel7 pgdg96
postgresql96-debuginfo.x86_64 9.6.4-1PGDG.rhel7 pgdg96
postgresql96-devel.x86_64 9.6.4-1PGDG.rhel7 pgdg96
postgresql96-docs.x86_64 9.6.4-1PGDG.rhel7 pgdg96
postgresql96-libs.x86_64 9.6.4-1PGDG.rhel7 pgdg96
postgresql96-odbc.x86_64 09.06.0410-1PGDG.rhel7 pgdg96
postgresql96-plperl.x86_64 9.6.4-1PGDG.rhel7 pgdg96
postgresql96-plpython.x86_64 9.6.4-1PGDG.rhel7 pgdg96
postgresql96-pltcl.x86_64 9.6.4-1PGDG.rhel7 pgdg96
postgresql96-server.x86_64 9.6.4-1PGDG.rhel7 pgdg96
postgresql96-tcl.x86_64 2.3.1-1.rhel7 pgdg96
postgresql96-tcl-debuginfo.x86_64 2.3.1-1.rhel7 pgdg96
postgresql96-test.x86_64 9.6.4-1PGDG.rhel7 pgdg96
[root@RH72 Downloads]#

yum install postgresql96-server
rpm -Uvh remi-release-7*.rpm epel-release-7*.rpm
yum install php php-gd php-mysql php-mcrypt