Today we are going to install PostgreSQL  and include Postgis module on a cPanel based servers.  PostgreSQL  is a open source object-relational database system. At this moment cPanel do support installation of this package using the cPanel scripts. But  at this moment the installed version of PostgreSQL  is 9.2 if we are using cPanel script. So we can look for how it can upgraded to the latest version.  Another thing we are implementing in the server is installing   Postgis  PostgreSQL   module in the same server.  By integrating  PostGIS  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 ATM center. Below the system environment we tested the working, feel free to test it on newer version. The idea of implementation is identical for newer versions too.

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 9.6.

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

Installing the ogrfdw binaries.  ogr_fdw the spatial vector foreign data wrapper.

Copy to Clipboard

Installing pgrouting binaries. pgRouting is a PostgreSQL extension that extends PostGIS for building Location Based Services (LBS) specifically for trip navigation and resource dispatch.

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
Copy to Clipboard

This completed our install and testing on pgsql,postgis setup on a cPanel based server. The article we recommend for install are given below. Also leave your thoughts and ideas in the comment box.

http://postgis.net/install/