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.
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:
on Fedora:
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:
On RHEL 7 and Fedora, use the custom provided script, as systemd does not allow us to run initdb via unit file:
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:
on RHEL 7 and Fedora:
Now, let's start PostgreSQL 9.5. On RHEL 6, this This is done using the init script:
on RHEL 7 and Fedora:
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
Please let us know if you see any packaging issues.
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-reloadafter adding a custom unit file.
Please let us know if you see any packaging issues.
Comments
Display comments as Linear | Threaded
Andrew Dunstan on :
$ 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 :
Martina on :
Aleshia Scurci on :
Diego Mcvay on :
Raul Jorden on :
Sharmaine Meleski on :
Sharen Rigney on :
Shakia Collicott on :
Madaline Belz on :
William Cripps on :
Clorinda Lagarde on :
Jamey Hanson on :
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."
Stefania Backous on :