Enable the SoftwareCollections.org repository

The first thing you need to do is to enable the
SoftwareCollections.org package repository. If you are using CentOS
then the command is the following:

$ sudo yum -y install centos-release-scl

Make sure that old packages are removed

If you have older versions of the postgresql packages installed you
may encounter conflicts with network ports, so it is good idea to stop
the database and remove those older packages before installing the new
version:

Install the PostgreSQL 10 collection

This will install the required files under /opt/rh/rh-postgresql10, so
each time you need to use a command like pgsql you will have to use
the complete path. Alternatively, you can enable that collection:

$ scl enable rh-postgresql10 bash

This will spawn a new shell where you can use the commands without the
full path, and it is useful when don’t need to run commands frequently.
But as you will probably want to run commands like psqlquite often, it
is better to enable the collection permanently, adding the following to
the relevant .bash_profile files:

Create and configure the database

By default the database directory used by the software collection is
/var/opt/rh/rh-postgresql10/lib/pgsql/data, but the ManageIQ
instructions assume it to be /var/lib/pgsql/data. The name of the
service is also different. Make sure to take these differences into
account when creating and configure the database. For example, to
initially create the database you will need to do the following: