PostgreSQL is a open source object-relational database system. In addition to that, PostgreSQL is highly extensible like we can define our own data types, build out custom functions etc. By integrating PostGIS with PostgreSQL we will get geographical capabilities to a database created in PostgreSQL and it can used for local based services or applications. for example an application which is used to find out nearby ATMs.

In cPanel based server, we can install PostgreSQL using cPanel scripts. But cPanel script install the version of PostgreSQL that ships with your operating system or available in the default Centos repository. So suppose you need an latest upgraded version of PostgreSQL in a cPanel server, follow below steps. I have tested it on Centos7.

Below the system environment we tested the working, feel free to test it on newer cPanel versions. 

System Environment


Copy to Clipboard

Install PostgreSQL

Use below cPanel script for PostgreSQL install.

Copy to Clipboard

Below are the rpm packages installed in the server. In your case the rpm package version may vary.

Copy to Clipboard

Now log in the WHM panel and go the section  Home »  SQL Services » Configure PostgreSQL

Click buttons like “install config”, “Create users” and set a Password for the default “postgres” system user password. This is the user created automatically during install of PostgreSQL . The password we set needed at the time of login in to the pgsql terminal.

Test the installed pgsql.

Copy to Clipboard

Upgrade current Pgsql version in to the latest version available. Going to install PostgreSQL 12.

Copy to Clipboard

At this moment we can see the newly installed postgresql running in the default port number 5432

Copy to Clipboard

Now we need to setup the symlinks for upgraded Postgres to work with cPanel/WHM.

Copy to Clipboard

Now log in the WHM panel and go the section  Home »  SQL Services » Configure PostgreSQL and run “Create users” “install config” and set a Password for “postgres” user.

Copy to Clipboard

For testing from cPanel. Log in the cPanel of a website and click the “PostgreSQL Databases” icon and create a test database. After that click the “phpPgAdmin” icon a new tab will open and it will show the newly created pgsql database, table and an option to run query. Its like the phpmyadmin used for MySQL.

Now install PostGIS.

Copy to Clipboard

Below are packages and their dependencies installed in the server.

Copy to Clipboard

Now we are going to enable and test the PostGIS extension in a newly created test database.

Copy to Clipboard
Copy to Clipboard

This concludes the installation, Upgrade of PostgreSQL database in a cPanel based server. After that we also installed PostGIS and verified it. Leave your thoughts at the below comment box.