How to Upgrade Postgresql To Postgresql 9.2 in CentOS ?

Postgresql 9.2 upgrade is possible only with the root access of the server, it is not supported by cPanel. Since it is installed as root there is a chance to break the cPanel existing files and other default softwares . You can follow the below procedure and install Postgresql 9.2 in the server via SSH, Other than this please dont change any configuration files in the server without the confirmation of the server admin.



Procedure

Before proceeding for the upgrade of Postgresql 9.2, follow the below procedure to enable the default version which is available in cPanel. After that you can able to upgrade to 9.2 version.

Procedure To Enable Default Version of Postgresql via cPanel

1.Login to WHM [ https://serverip:2087 ]

2.Click on Home » Software » EasyApache 4

3.Click on “customize” in the current profile

4.Go to “PHP extension”

5.Search for “php56-php-pgsql”  and enable.

6.Click on “next ”

7.After that click on “provision”

Now you have enabled the default Postgresql option in the WHM.

Procedure To upgrade Postgresql to 9.2 from default version installed via cPanel

1.Download the putty software from “http://www.putty.org/” and install it in your system.

2. After installing it, Launch putty and enter the below details.

      Host name (or IP address) : Give the server IP
      Port : Give the port number

Click on open

3. After that it asks to enter the username.

      login as: Give as “root

then copy the root password and go to the putty, in password field if you click the right button of the mouse and press enter, the password will be placed and logged in to shell as root user.

4. Then you can go to the tmp directory by using the command

cd /tmp

5. Steps to Upgrade Postgresql 9.2 :

[ Have to put the following commands one by one ]

wget http://yum.postgresql.org/9.2/redhat/rhel-6-x86_64/pgdg-centos92-9.2-6.noarch.rpm
rpm -i pgdg-centos92-9.2-6.noarch.rpm
yum groupinstall “PostgreSQL Database Server 9.2 PGDG” -y
yum install postgresql92-devel.x86_64 -y
service postgresql-9.2 initdb
chkconfig postgresql-9.2 on

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

cd /var/lib/pgsql; ln -s 9.2/backups; ln -s 9.2/data; ln -s 9.2/pgstartup.log

cd /usr/pgsql-9.2/lib; ln -s libpq.so.5.5 libpq.so

service postgresql-9.2 start

[ Have to do this in the WHM ]

-Log into cPanel/WHM as root
-Navigate to “Home > SQL Services > Configure PostgreSQL”
-Click on “Install config”

6 . Have to update phppgadmin and add the below lines in SSH ,

/usr/local/cpanel/bin/updatephppgadmin –force

vi /etc/yum.repos.d/CentOS-Base.repo

[ Add this line under [base] and [updates] ]
exclude=postgres*

7. Now you can check using the below command ,

psql –version