Skip to content

Installing and running PostgreSQL 9.5 using RPMs on RHEL/CentOS/Scientific Linux/Oracle Linux and Fedora

PostgreSQL 9.5 was released recently. We released PostgreSQL 9.5 RPMs at the same day.

In this blog post, I am going to write you how to install PostgreSQL 9.5 on RHEL/CentOS/Scientific Linux/Oracle Linux 6 and 7 , Fedora 22 and 23.
First, as usual, you need to install the repository package. Please visit the repo RPMs page. You will see a link to the repo package links. Choose your distro/arch, and install the RPM to your server via your package manager.

Next step is installing PostgreSQL 9.5. You can either install the individual RPMs, or use groupinstall feature that install -libs, -server, -contrib along with the client package.

Please note that Fedora switched to dnf, so the commands will differ slightly:

On RHEL 6 and 7:

yum install postgresql95-server postgresql95-contrib


on Fedora:

dnf install postgresql95-server postgresql95-contrib


The next step is initializing the cluster. This step is different on RHEL 6, as compared to others. On RHEL 6, you can use the init script for initializing your cluster:

service postgresql-9.5 initdb


On RHEL 7 and Fedora, use the custom provided script, as systemd does not allow us to run initdb via unit file:

/usr/pgsql-9.5/bin/postgresql95-setup initdb


If there is no error message, you are ready to start the cluster.

Before starting, let's make sure that PostgreSQL will start on boot. On RHEL 6:

chkconfig postgresql-9.5 on


on RHEL 7 and Fedora:

systemctl enable postgresql-9.5.service


Now, let's start PostgreSQL 9.5. On RHEL 6, this This is done using the init script:

service postgresql-9.5 start


on RHEL 7 and Fedora:

systemctl start postgresql-9.5.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
systemctl daemon-reload
after adding a custom unit file.

Please let us know if you see any packaging issues.

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

Andrew Dunstan on :

You don't need to make a copy of the systemd file. Here's what I have in one instance:

$ cat /etc/systemd/system/postgresql-9.4.service
.include /lib/systemd/system/postgresql-9.4.service
[Service]
Environment=PGDATA=/db-data/data

Devrim Gündüz on :

Thanks Andrew.

Martina on :

Having said that, you can easily help this along by concentrating on developing your psychic ability exterior of readings.

Jamey Hanson on :

I think we sell PostgreSQL short and create future problems for users by not including more of the ecosystem in a basic/default installation. For example, this process does not include postgresqlXX-docs, pgagent, barman, pgpool, pg_top, pl or PostGIS (which requires EPEL). I realize that all these tools (and many more!) are available to people who want them ... but please consider updating "default" instructions to include more of the PostgreSQL ecosystem.

It is challenging to work with clients who hear about great things PostgreSQL can do and always have to respond ... "Oh, you don't get that data-type/language/utility/etc. unless you do a special installation."

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.


Form options