Install latest PostgreSQL on cPanel

As some people may know there is a handy script within cPanel’s scripts folder which can install PostgreSQL, however it does not install the latest versions. It instead installs the vendor versions which on CentOS would be coming from yum. So this means for someone running CentOS4 they’ll get about 7.3 and for someone running CentOS5 they’ll get 8.1. Both of which aren’t the newest version 8.3.1.

So here’s how you can get the latest versions installed with very little work.

1. Login as root and make a directory for the postgres rpm files you’re going to download.
2. Go to the mirror page at http://wwwmaster.postgresql.org/download/mirrors-ftp and find an acceptable mirror for you. Once you’ve got a mirror navigate to your OS and distribution.  If you’re running CentOS then RHEL is acceptable for your binary files.
3.  Now all you need to do is download the following files

  • postgresql-contrib
  • postgresql-libs
  • postgresql-devel
  • postgresql-plpython
  • postgresql-plperl
  • postgresql
  • postgresql-docs
  • postgresql-server

Of course adding on the version number and anything else that may be included.  So in our case for CentOS 5 we downloaded the following files

http://ftp8.us.postgresql.org/postgresql/binary/v8.3.1/linux/rpms/redhat/rhel-5-i386/postgresql-contrib-8.3.1-1PGDG.rhel5.i686.rpm

http://ftp8.us.postgresql.org/postgresql/binary/v8.3.1/linux/rpms/redhat/rhel-5-i386/postgresql-libs-8.3.1-1PGDG.rhel5.i686.rpm

http://ftp8.us.postgresql.org/postgresql/binary/v8.3.1/linux/rpms/redhat/rhel-5-i386/postgresql-devel-8.3.1-1PGDG.rhel5.i686.rpm

http://ftp8.us.postgresql.org/postgresql/binary/v8.3.1/linux/rpms/redhat/rhel-5-i386/postgresql-plpython-8.3.1-1PGDG.rhel5.i686.rpm

http://ftp8.us.postgresql.org/postgresql/binary/v8.3.1/linux/rpms/redhat/rhel-5-i386/postgresql-plperl-8.3.1-1PGDG.rhel5.i686.rpm

http://ftp8.us.postgresql.org/postgresql/binary/v8.3.1/linux/rpms/redhat/rhel-5-i386/postgresql-8.3.1-1PGDG.rhel5.i686.rpm

http://ftp8.us.postgresql.org/postgresql/binary/v8.3.1/linux/rpms/redhat/rhel-5-i386/postgresql-docs-8.3.1-1PGDG.rhel5.i686.rpm

http://ftp8.us.postgresql.org/postgresql/binary/v8.3.1/linux/rpms/redhat/rhel-5-i386/postgresql-server-8.3.1-1PGDG.rhel5.i686.rpm

You may not need all of these but I rather just get all of them instead of a few and need the others later.  Finally since all the files are you in the same directory all you need to run is:

rpm -ihv postgr*

You now have successfully installed PostgreSQL.  Now you just need to login to WHM run the “Postgres Config”  options of install config then setting a password and finally restart PostgreSQL from within WHM.  You should now be running the latest version!

Hopefully cPanel considers maintaining PostgreSQL like they do MySQL in the future but until then this should be helpful for the few who are wishing to run the latest PostgreSQL on cPanel.

This entry was posted in General. Bookmark the permalink.

26 Responses to Install latest PostgreSQL on cPanel

  1. Kwasi says:

    after following your instructions for postgres 8.3.5 i get the following

    warning: postgresql-contrib-8.3.5-1PGDG.rhel5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 442df0f8
    error: Failed dependencies:
    libossp-uuid.so.15 is needed by postgresql-contrib-8.3.5-1PGDG.rhel5.i386
    postgresql = 8.3.5 is needed by postgresql-contrib-8.3.5-1PGDG.rhel5.i386
    postgresql = 8.3.5-1PGDG.rhel5 is needed by postgresql-devel-8.3.5-1PGDG.rhel5.i386
    postgresql = 8.3.5 is needed by postgresql-plpython-8.3.5-1PGDG.rhel5.i386
    postgresql = 8.3.5 is needed by postgresql-pltcl-8.3.5-1PGDG.rhel5.i386
    postgresql = 8.3.5-1PGDG.rhel5 is needed by postgresql-server-8.3.5-1PGDG.rhel5.i386

  2. Kwasi says:

    these are what I downloaded

    compat-postgresql-libs-4-1PGDG.rhel5.i686.rpm
    compat-postgresql-libs-debuginfo-4-1PGDG.rhel5.i686.rpm
    postgresql-contrib-8.3.5-1PGDG.rhel5.i386.rpm
    postgresql-debuginfo-8.3.5-1PGDG.rhel5.i386.rpm
    postgresql-devel-8.3.5-1PGDG.rhel5.i386.rpm
    postgresql-docs-8.3.5-1PGDG.rhel5.i386.rpm
    postgresql-libs-8.3.5-1PGDG.rhel5.i386.rpm
    postgresql-plperl-8.3.5-1PGDG.rhel5.i386.rpm
    postgresql-plpython-8.3.5-1PGDG.rhel5.i386.rpm
    postgresql-pltcl-8.3.5-1PGDG.rhel5.i386.rpm
    postgresql-server-8.3.5-1PGDG.rhel5.i386.rpm
    postgresql-test-8.3.5-1PGDG.rhel5.i386.rpm

    from url

    http://ftp9.us.postgresql.org/pub/mirrors/postgresql/binary/v8.3.5/linux/rpms/redhat/rhel-5-i386/

    I’m unsing CENTOS 5.2 i686 on VPS

  3. Tony says:

    The issue is with the latest version it requires uuid. Since you use CentOS you can just do “yum install uuidd”. I believe that’ll fix it.

  4. Kwasi says:

    After installing uuid, i’m getting the following error

    Installed: uuidd.i386 0:1.39-15.el5
    Complete!
    [root@websitematrix01 postgre_8_3_5]# rpm -ihv postgr*
    warning: postgresql-contrib-8.3.5-1PGDG.rhel5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 442df0f8
    error: Failed dependencies:
    libossp-uuid.so.15 is needed by postgresql-contrib-8.3.5-1PGDG.rhel5.i386
    postgresql = 8.3.5 is needed by postgresql-contrib-8.3.5-1PGDG.rhel5.i386
    postgresql = 8.3.5-1PGDG.rhel5 is needed by postgresql-devel-8.3.5-1PGDG.rhel5.i386
    postgresql = 8.3.5 is needed by postgresql-plpython-8.3.5-1PGDG.rhel5.i386
    postgresql = 8.3.5 is needed by postgresql-pltcl-8.3.5-1PGDG.rhel5.i386
    postgresql = 8.3.5-1PGDG.rhel5 is needed by postgresql-server-8.3.5-1PGDG.rhel5.i386

  5. Kwasi says:

    Ok I fixed the libossp-uuid.s0.15 dependency issue

    Step followed

    1. wget http://download.fedora.redhat.com/pub/epel/5/i386/uuid-1.5.1-3.el5.i386.rpm

    2. rpm -Uhv uuid-1.5.1-3.el5.i386.rpm

    but now I still have the following

    postgresql = 8.3.5 is needed by postgresql-contrib-8.3.5-1PGDG.rhel5.i386
    postgresql = 8.3.5-1PGDG.rhel5 is needed by postgresql-devel-8.3.5-1PGDG.rhel5.i386
    postgresql = 8.3.5 is needed by postgresql-plpython-8.3.5-1PGDG.rhel5.i386
    postgresql = 8.3.5 is needed by postgresql-pltcl-8.3.5-1PGDG.rhel5.i386
    postgresql = 8.3.5-1PGDG.rhel5 is needed by postgresql-server-8.3.5-1PGDG.rhel5.i386

  6. Tony says:

    What command did you run? You should run rpm -ihv postgr* . All that is talking about is dependencies between the packages themselves. You could get around that by just installing them in the correct order.

  7. Kwasi says:

    Yes I did run that command if I’m to install them in the correct order what would that be, as I tried that but nothing. I keep getting dependency issues, totally boring…

  8. Tony says:

    You’re missing one of the files:

    postgresql-8.3.5-1PGDG.rhel5.i386.rpm

    http://ftp9.us.postgresql.org/pub/mirrors/postgresql/binary/v8.3.5/linux/rpms/redhat/rhel-5-i386/postgresql-8.3.5-1PGDG.rhel5.i386.rpm

    Then you can run rpm -ihv postgr*

  9. Kwasi says:

    it’s ok, I followed this guide (http://www.postgresonline.com/journal/index.php?/archives/45-An-Almost-Idiots-Guide-to-PostgreSQL-YUM.html) and now I think everything is 100%, now I have to sort out my ns records, SVN, Trac and I will be good for business.

    Thanks, the next newbie will have it easy with all the information :)

  10. Tony says:

    Interesting guide.

  11. Andrew says:

    I followed this and all seems to work with v8.3.4 on CENTOS 4.7…
    The only problem I have is nothing is getting added to CPanel?
    If I manually go to: http://xxxxxx:2082/frontend/x3/psql/
    Try to create a database I get:
    There was a problem creating the database.Show Details:
    Error from postgres wrapper: PostgreSQL version is not sufficient. Version . is not supported.

    Can you tell me what I need to do to make it work with CPanel?

  12. Tony says:

    Once you install the RPM’s you need to login to WHM and setup the postgres config. There should be a link on the WHM menu as it detects PostgreSQL running.

  13. stanimir says:

    I have old postgre 8.1 installed from Cpanel. How can upgrade to 8.3 ?
    this is the result from: rpm -ihv postgr*

    file /usr/share/locale/tr/LC_MESSAGES/pg_config.mo from install of postgresql-devel-8.3.7-1PGDG.rhel5.x86_64 conflicts with file from package postgresql-devel-8.1.11-1.el5_1.1.x86_64
    file /usr/share/man/man1/ecpg.1.gz from install of postgresql-devel-8.3.7-1PGDG.rhel5.x86_64 conflicts with file from package postgresql-devel-8.1.11-1.el5_1.1.x86_64
    file /usr/share/man/man1/pg_config.1.gz from install of postgresql-devel-8.3.7-1PGDG.rhel5.x86_64 conflicts with file from package postgresql-devel-8.1.11-1.el5_1.1.x86_64

  14. friend says:

    Hi,

    I have installed v8.3.5 as was wrote here. Then I have configured in WHM. But I can’t create databases via cpanel. It writes that database is created then I back to list, but there are no databases. Also can’t login to PHPPgAdmin. Could you help me?

    P.S. Sorry for my English. Would be better to write on Ukrainian for me :-)

  15. Tony says:

    You need to modify the /var/lib/pgsql/data/pg_hba.conf on cPanel servers:

    I believe you need to replace this:

    # “local” is for Unix domain socket connections only
    local all all ident sameuser
    # IPv4 local connections:
    host all all 127.0.0.1/32 ident sameuser
    # IPv6 local connections:
    host all all ::1/128 ident sameuser
    local all all md5
    host all all 127.0.0.1 255.255.255.255 md5

    WITH this:

    host all all 127.0.0.1 255.255.255.0 md5
    local all all md5
    host all all 127.0.0.1 255.255.255.255 md5

    I believe that’ll fix it. For some reason on some cPanel servers it does not like the ident portion above probably should be removed when cPanel switches it to md5 authentication but it does not.

  16. Andrew says:

    I have everything working in v8.3.5 except…
    I can’t create databases via cpanel.
    It indicates the database is created but I go back and it’s not listed and there are no databases.
    I can create users and they stay there just fine…
    I can also login to PHPPgAdmin just fine also…..

    In /var/lib/pgsql/data/pg_hba.conf I have this:
    host all all 127.0.0.1 255.255.255.0 md5
    local all all md5
    host all all 127.0.0.1 255.255.255.255 md5

    Any ideas?

  17. Tony says:

    Did you make sure to run the postgres config portion in WHM?

  18. Kwasi says:

    I’m also having the same problems, tried going through guide at http://forums.cpanel.net/f4/postgresql-fixing-39929.html.

    Put have been unsuccessful, still looking for solution but I think guide link above may help others

  19. Kwasi says:

    Has anyone successfully installed Postgres 8.4 on centos5 and managed to configure WHM/CPanel to work with it? I don’t understand why one needs to go through so much frustration just to get the latest db installed MySQL.

  20. Kwasi says:

    http://forums.cpanel.net/f5/postgresql-db-users-not-showing-cpanel-131245.html

    This user is experiencing my issues, but still no solution anyone?

  21. Tony says:

    The user in the forum mentioned they fixed it changing md5 to trust:

    ———–
    local all all md5
    host all all 127.0.0.1 255.255.255.255 md5
    ———–
    local all all trust
    host all all 127.0.0.1 255.255.255.255 trust

    I’m not sure if that’s the best solution though. I would advise you just make a support ticket with cPanel. You can do this via http://tickets.cpanel.net/ . Even though their installer uses distribution versions I imagine they’ll help with getting the integration to work for you. Especially considering the only thing that is broken is the integration which doesn’t even work properly when using distribution versions until you modify pg_hba.conf.

  22. Phil says:

    Sorry … changing md5 to trust cannot be the answer, that leaves your PostgreSQL server totally open to access … so anyone on that machine could connect via localhost.

    Everything above should work if your setup a .pgpass file in the home directory of the cPanel admin (root or master reseller).

  23. Tony says:

    Yeah that appears to be some bad advice I didn’t even notice it said trust on it. md5 works fine for me when we do postgresql on cPanel servers. phppgadmin works and all of that without any major modifications to the system.

  24. Z says:

    I get a huge list of errors similar to the below after running rpm -ihv postgr*

    file /usr/include/pgsql/server/storage/lwlock.h from install of postgresql-devel-8.4.6-1PGDG.rhel5.i386 conflicts with file from package postgresql-devel-8.1.23-1.el5_6.1.i386
    file /usr/include/pgsql/server/storage/off.h from install of postgresql-devel-8.4.6-1PGDG.rhel5.i386 conflicts with file from package postgresql-devel-8.1.23-1.el5_6.1.i386
    file /usr/include/pgsql/server/storage/pg_sema.h from install of postgresql-devel-8.4.6-1PGDG.rhel5.i386 conflicts with file from package postgresql-devel-8.1.23-1.el5_6.1.i386
    file /usr/include/pgsql/server/storage/pg_shmem.h from install of postgresql-devel-8.4.6-1PGDG.rhel5.i386 conflicts with file from package postgresql-devel-8.1.23-1.el5_6.1.i386
    file /usr/include/pgsql/server/storage/pmsignal.h from install of postgresql-devel-8.4.6-1PGDG.rhel5.i386 conflicts with file from package postgresql-devel-8.1.23-1.el5_6.1.i386
    file /usr/include/pgsql/server/storage/pos.h from install of postgresql-devel-8.4.6-1PGDG.rhel5.i386 conflicts with file from package postgresql-devel-8.1.23-1.el5_6.1.i386

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>