Installing PostgreSQL

Installing PostgreSQL
4.6 (91.43%) 7 votes

PostgreSQL is an open-source database server similar (but different) than MySQL. cPanel has a built-in installer for setting up PostgreSQL easily. Keep in mind that the actual version of PostgreSQL you get depends on your OS version. For instance, CentOS 4 users will likely get version 7, CentOS 5 will get version 8.

First, run the install script from command line

/scripts/installpostgres

Then in WHM under SQL Services >> Postgres Config Choose Install Config. Once the config has been installed set a root password for PostgreSQL (Only Alphanumerics). If you hav a firewall, you may want to open port 5432.

PostgreSQL is installed now, but PHP is not compiled for it, so you'll need to run EasyApache and enable PHP with PostgreSQL (pgsql) support. You can do this manually, or through WHM. If doing so manually, here is the configure switch (or use with /var/cpanel/easy/apache/custom/rawopts  [La Magie De La Reconquête – The Magic Of Making Up French Version

easyapache/ea3custom_flags.html” target=”_blank”>info])

--with-pgsql=/usr

Now when you log into cPanel you'll see a section for PostgreSQL. You'll probably notice the phpMyAdmin wannabe phpPgAdmin which is the database management tool for Postgres. If  you don't see this option, make sure it's enabled in WHM > Feature Manager.

Now edit /var/lib/pgsql/data/postgresql.conf and edit some settings:

port = 5432

Postgres 7:

tcpip_socket = true

Postgres 8:

listen_addresses='*'

Now restart the postgres service:

service postgres restart

Note that if you're installing PostgreSQL on a server that already has users on it, privileges will not be added by default for those existing users. To add privileges, run this command:

for user in `ls /var/cpanel/users` ; do su $user -c “createuser -S -D -R $i” postgres; done

La Magie De La Reconquête – The Magic Of Making Up French Version
zp8497586rq

3 Comments

    1. Vanessa

      Keep in mind that WordPress does weird things to double dashes and quotes – try typing the commands instead of copying and pasting them

  1. Nathan P

    Just FYI to everyone, you need to run /scripts/makecpphp after easy apache and config setup. cPanel’s PhpPGAdmin will warn you it’s not installed for php.

Log in