How to Install Postgres / Posgresql on CentOS 7 (or RHEL 7)

All as root as performed on two onMetal Cloud I/Ov2 instances at RackSpace with rackconnect networking to get these well spec’d instances behind our primary dedicated firewall.
For some licensing reason, Red Hat doesn’t allow RHEL licenses to these onMetal servers. So, it was a good excuse to use CentOS instead. So far, seems to be the same deal practically speaking.

1. add necessary repo

There is a yum version of this farther down. The above command assumes Centos 7 is your operating system. You can use this site to get a similar command to execute based on making some selections from a few dropdowns:

Bear in mind the current version 10 software is 10.6 at the time of last editing this article.

This should give you an idea of the EOL schedule for version of postgres going back to 9.0

BTW, instead of using rpm, we can also use yum:

The output of the above step should produce something similar in your terminal

2. install the necessary packages

You at least need postgresql10, likely postgresql10-server. The other two will probably come in handy: postgresql10-contrib & postgresql10-libs.

Here’s what the transaction summary might look like
Here’s what got installed

3. enable postgres to start automatically upon reboot

The result of the above command should look something like this ^^^

4. init (initialize) the cluster

Use this command to init the cluster in its default location on the system disk.

we can check configs and whatnot from

Now we can verify the install

This message predicts the future

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store