How to: Install PostgreSQL on cPanel

PostgreSQL is a free database server alternative to the traditional MySQL server that comes preinstalled on all cPanel servers. If you need PostgreSQL on cPanel let me tell you that cPanel has a built in easy-to-use installer to make your life easier. On this tutorial you will learn fast & easy how to install PostgreSQL on cPanel.

Important considerations before we begin: cPanel and WHM software do not supply any PostgreSQL versions to update or PostgreSQL, they just run an installer that installs the PostgreSQL version that comes by default with your operating system.

Install PostgreSQL on cPanel servers

Login as root and type:

/scripts/installpostgres

Once that is done, move to WHM >> Postgres Config >> “Install Config”.  PostgreSQL should now be fully accessible from your cPanel user interface.

Optional: Compile PHP support for PostgreSQL

Our PostgreSQL installation is not finished yet, we will have to compile PHP support so your scripts can use PostgreSQL as database server. For that you will need to run EasyApache and enable PHP with PostgreSQL (pgsql) support. You can do this manually, or through WHM.

/scripts/easyapache

Testing PostgreSQL on cPanel

The best way to test it is to launch a query against your database from phpPgAdmin, which is the database management app you will use to manage your PostgreSQL databases. If phpPgAdmin is not present on your cPanel interface, you can enable it from WHM > Feature Manager.

Configuring PostgreSQL

If you ever need to tweak out the PostgreSQL configuration manually, this can be done by editing /var/lib/pgsql/data/postgresql.conf file.

Once you are ready making the necessary changes, you can restart the service by typing:

service postgres restart

See it wasn’t that hard? Install PostgreSQL on cPanel servers should be an easy task for you from now on, it’s always a valuable knowledge as most cPanel software runs on Perl.

About the Author: Santiago Borges

Experienced Sr. Linux SysAdmin and Web Technologist, passionate about building tools, automating processes, fixing server issues, troubleshooting, securing and optimizing high traffic websites.

1 Comment

Leave a Reply

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