BuycPanel Blog

BuycPanel Blog

Latest news and updates

How to Install or Update PostgreSQL on your cPanel Server

Posted by Allura on 29 08 2018.

A Brief Overview
The process of either installing or updating PostgreSQL on a cPanel server is best performed by an expert in that particular field, such as a databse administrator for instance. However, the aforementioned process is not very long or convoluted and can be executed in a few distinct steps.

Backing Up The Databases
Before one begins the installation process at all, one should ensure that the data present on his or her server has been duplicated or ‘backed-up’ as a precautionary measure. This can be restored once the installation process is complete. The same rule applies in case a user wishes to update the software. One must sign in to one’s cPanel account, verify oneself as the root user using SSH and then run the given command – pg_dumpall > db.out

Installing, Updating or Configuring PostgreSQL –
The following are the necessary steps that a cPanel user must follow in order to update…

A Brief Overview

The process of either installing or updating PostgreSQL on a cPanel server is best performed by an expert in that particular field, such as a databse administrator for instance. However, the aforementioned process is not very long or convoluted and can be executed in a few distinct steps.

Backing Up The Databases

Before one begins the installation process at all, one should ensure that the data present on his or her server has been duplicated or ‘backed-up’ as a precautionary measure. This can be restored once the installation process is complete. The same rule applies in case a user wishes to update the software. One must sign in to one’s cPanel account, verify oneself as the root user using SSH and then run the given command – pg_dumpall > db.out

Installing, Updating or Configuring PostgreSQL –

The following are the necessary steps that a cPanel user must follow in order to update or install PostgreSQL:

  • Firstly, the user must run the given command – /usr/local/cpanel/scripts/installpostgres – It is this command that will initiate the entire process.
  • The user must then make his or her way to the Configure PostgreSQL interface of WHM (Web Host Manager). This may be done by simply clicking on the SQL Services option on the Home page of WHM.
  • If one is installing the software for the first time on his or her device, one must click on the Install/Config option available. In case one has PostgreSQL pre-installed, this command will override any former ones to perform the same function. Hence, this acts also as a way to update PostgreSQL.
  • Once this is complete the user may add existing cPanel users to the PostgreSQL by simply using the Create Users
  • Finally, for security purposes it is advisable that the root user choose a complex, new password for his or her account.
  • Once all of this is done, the user may safely import and hence restore all of his or her databases by issuing the following command – psql dbname < dumpfile.sql

With this step the process of updating or of installing PostgreSQL stands comprehensively completed.

 

Steps With Basic Troubleshooting

However, in case of an installation or updating process failing to complete, the user may revert back temporarily to his or her old PostgreSQL version. This signifies that they shall be able to restore their old directory as well. This may be accomplished by running the following commands respectively –

service postgresql stop

mv /var/lib/pgsql /var/lib/directory_file_name

mv /var/lib/pgsql.old /var/lib/pgsql

service postgresql restart

What Next?

For further queries about the given product or process one may access the official PostgreSQL Website.