Installing PostgreSQL on cPanel/WHM Server

October 2009 • By admincPanel

PostgreSQL is a powerful, open source object-relational database system. While cPanel primarily supports MySQL, you can also install and use PostgreSQL on cPanel/WHM servers.

Installation on CentOS/RHEL

yum install postgresql postgresql-server
service postgresql initdb
service postgresql start
chkconfig postgresql on

Configure PostgreSQL

Edit the pg_hba.conf file to allow connections:

nano /var/lib/pgsql/data/pg_hba.conf

Change the authentication method for local connections:

local   all         all                               md5
host    all         all         127.0.0.1/32          md5

Create Admin User

su - postgres
psql
CREATE USER myuser WITH PASSWORD 'mypassword';
CREATE DATABASE mydb OWNER myuser;
GRANT ALL PRIVILEGES ON DATABASE mydb TO myuser;
\q

cPanel Integration

WHM has a PostgreSQL section that allows you to manage PostgreSQL databases for your users. Navigate to WHM → PostgreSQL to configure the integration.