Next step is installing RPMs. You can either install the individual RPMs, or use groupinstall feature that install -libs, -server, -contrib along with the client package.
To install PostgreSQL 9.4 on RHEL 7, please run
yum groupinstall "PostgreSQL Database Server 9.4 PGDG"
To install PostgreSQL 9.3 on RHEL 7, please run
yum groupinstall "PostgreSQL Database Server 9.3 PGDG"
The next step is initializing the cluster. This is done using a command line tool, which is designed for the RPMs. Please run this command as root.
If there is no error message, you are ready to start the cluster. This is done using the unit files:
systemctl start postgresql-9.4.service
systemctl start postgresql-9.3.service
The postmasters should start, if there is no port conflict, etc.
As of RHEL 7, as done in the Fedora packages for two years, the unit files are located under /lib/systemd/system/ directory. Please do not edit these files directly. Instead, if you want to make any changes, create a copy of them under /etc/systemd/system/ , and edit those files. Run
after adding a custom unit file.
Also, as of RHEL 7, we got rid of the PGPORT variable in unit files. This will fix the issues caused by changing the port number both in init script / unit file and postgresql.conf. The port can now only be changed in postgresql.conf.
In order to start PostgreSQL on boot, you need to enable the unit file:
systemctl enable postgresql-9.4.service
systemctl enable postgresql-9.3.service
To restart or reload the instance, you can use the following commands: