cPanel’s support for PostgreSQL is notably bad, but it’s easy to work around the existing limitations and to install the latest shiny release of Postgres (currently 9.4, with jsonb support!).
First, you need to add the Postgres repository to your system. You can find the link to the latest RPM file on Postgres website.
rpm -Uvh http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-redhat94-9.4-1.noarch.rpmThen, install it using yum:
yum install postgresql94-server postgresql94When the installation completes, you’ll need to run the setup script and enable the Postgres service:
/usr/pgsql-9.4/bin/postgresql94-setup initdb
chkconfig postgresql-9.4 onYou’ll also need to setup the symlinks for Postgres to work with the cPanel/WHM hooks:
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.logIf you want to install phpPgAdmin, you will need to run cPanel’s installation script:
/usr/local/cpanel/bin/updatephppgadminFinally, log into WHM and go to Configure PostgreSQL. Click on Install Config, wait, click on Create Users, wait and then reboot your server. Voilà!
