Nerdier

Adjective: Comparative form of nerdy: more nerdy.

Install PostgreSQL 9.x on cPanel.

How to install a later version of PostgreSQL than the version it provides.

Install the latest version of PostgreSQL from here.

    cd /usr/src
    wget http://yum.pgrpms.org/9.2/redhat/rhel-5-x86_64/pgdg-centos92-9.2-6.noarch.rpm
    rpm -Uvh pgdg-centos92-9.2-6.noarch.rpm

You can now install from yum.

    yum install postgresql92 postgresql92-server postgresql92-devel

Create some symlinks

    ln -s /var/lib/pgsql/9.2/data /var/lib/pgsql 
    ln -s /var/lib/pgsql/9.2/backups /var/lib/pgsql
    cd /usr/pgsql-9.2/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

Initialize PostgreSQL and start it.

    service postgresql-9.2 initdb
    service postgresql-9.2 start

Login to WHM and go to:

‘SQL Services > Configure Postgres > Install Config’

Then you need to edit the pg_hba.conf

    nano /var/lib/pgsql/9.2/data/pg_hba.conf

Replace md5 with trust

Then in WHM go to;

‘Restart Services > SQL Server (PgSQL) > Yes’

‘SQL Services > Configure Postgres > Generate Password > Change Password’

‘SQL Services > Configure Postgres > Create Users’

‘Restart Services > SQL Server (PgSQL) > Yes’

Create another symlink for the config file used by pecl etc

ln -s /usr/pgsql-9.2/bin/pg_config /usr/bin

Finished!

Leave a Reply

Your email address will not be published. Required fields are marked *