This document explains how to install or update PostgreSQL® on a server. However, we strongly recommend that you allow an experienced PostgreSQL database administrator to perform this process.
We only support versions of PostgreSQL that you install with the
cPanel & WHM functions with the version of PostgreSQL that ships with your operating system.
Before you install or update PostgreSQL on your server, back up your server's databases. This action allows you to restore your databases after you install or update PostgreSQL.
To back up your databases, log in to your server as the
root user via SSH and perform the following steps:
Back up the PostgreSQL databases on your server. To do this, run the following command:
pg_dumpall -U postgres > db.out
In this example,
To revert to your previous version of PostgreSQL, move your current PostgreSQL data directory. To do this, run the following commands:
service postgresql stop mv /var/lib/pgsql /var/lib/directory_file_name
To install or upgrade and configure PostgreSQL on your server, perform the following steps:
/usr/local/cpanel/scripts/installpostgres command to install or upgrade PostgreSQL.
Click Install Config if PostgreSQL does not exist on your server.
If a PostgreSQL configuration already exists on your server, this action overwrites your configuration authentication file.
Confirm your new password, and click Change Password.
Only use letters and numbers. Non-alphanumeric characters can cause errors to occur.
Import your databases. To do this, run the following command:
psql -U postgres dbname < dumpfile.sql
If the new installation fails, revert to your previous version of PostgreSQL and restore the earlier PostgreSQL data directory. To do this, run the following commands:
service postgresql stop mv /var/lib/pgsql /var/lib/directory_file_name mv /var/lib/pgsql.old /var/lib/pgsql service postgresql restart
For more information about PostgreSQL, visit the PostgreSQL website.