cPanel – Install PostgresSQL 9.4

Published on Author gryzli

This howto shows how to install additional PostgresSQL (latest stable) on a cPanel server (11.38 in my case). 

!!  I assume your server doesn’t have any PostgreSQL installed !!

1. Add the postgres repository to cPanel

yum install


2. Install postgres 9.4 packages

yum install postgresql94-server.x86_64 postgresql94-devel.x86_64 postgresql94.x86_64

3. Add postgresql to exclude directive in /etc/yum.conf

vim /etc/yum.conf
# Add this to the end of the “exclude=” line:


4. Install postgres in cPanel (this MUST NOT install any yum packages, and also installer could throw some errors)


5. install the symlinks

cd /usr/pgsql-9.4/bin/; for f in *; do echo $f; [ -e /usr/bin/$f ] && mv /usr/bin/$f /usr/bin/$f.8; ln -s $(pwd)/$f /usr/bin/$f; done
cd /var/lib/pgsql; ln -s 9.4/backups; ln -s 9.4/data; ln -s 9.4/pgstartup.log


6. Initialize Postgres database and configure postgres to start at startup

service postgresql-9.4 initdb
chkconfig postgresql-9.4 on
/etc/init.d/postgresql-9.4 start


7. Configure PostgreSQL from WHM


WHM –> Configure PostgreSQL –> Install Config
WHM –> Configure PostgreSQL –> Create Users
WHM –> Configure PostgreSQL –> Change password (Generate new one)


8. Finally install phpPgAdmin


9. Restart postgres

/etc/init.d/postgresql-9.4 restart

10. Add firewall rule for accessing local postgres server

iptables -t filter -I INPUT -s -p tcp –dport 5432 -j ACCEPT