Install PostgreSQL 8.4 Database Server on CentOS, Fedora, Red Hat

This is quick guide howto install PostgreSQL 8.4 (current stable 8.4.7) database server on CentOS, Fedora and Red Hat. Fedora 14, Fedora 13, CentOS 5.5 and Red Hat (RHEL) 5.5 has PostgreSQL 8.4 database server as default so extra repositories is not needed. Personally, I like to use Postgres own repositories, because the latest version of PostgreSQL may be quickly and easily installed. The following commands run as root and postgres user, so “su -” or “sudo -i” first.

Install PostgreSQL 8.4 Database Server Using PostgreSQL’s repositories

Install PostgreSQL repository:

Install postgresql and postgresql-server packages from PostgreSQL’s repositories:

Alternative PostgreSQL 8.4 Install Method for Fedora 12, Fedora 13, CentOS 5.5, Red Hat (RHEL) 5.5

Install postgresql and postgresql-server packages on CentOS 5.5 and Red Hat (RHEL) 5.5:

Install postgresql and postgresql-server packages on Fedora 12 and Fedora 13:

Configure PostgreSQL 8.4 Database Server

Initialize the cluster first with initdb command:

Edit /var/lib/pgsql/data/postgresql.conf file:

Set PostgreSQL server to listen all addresses and Change PostgreSQL port (default is 5432). Add/Uncomment/Edit following lines:

Edit /var/lib/pgsql/data/pg_hba.conf file:

Add (example) your local network with md5 passwords:

Start/Restart PostgreSQL Server:

Change to postgres user:

Create test database (as postgres user):

Login test database (as postgres user):

Create New “testuser” Role with Superuser and Password:

Open PostgreSQL Port (5432) on Iptables Firewall (as root user again)

Edit /etc/sysconfig/iptables file:

Add following line before COMMIT:

Restart Iptables Firewall:

Test remote connection:

Share this post

38 Comments

  1. Also even if I couldn’t add the repo I still ran:

    yum install postgresql84 postgresql84-server postgresql84-contrib

    I got a list of what was available:

    ================================================================================
    Installing:
    postgresql84 x86_64 8.4.13-1.el5_8 base 3.7 M
    postgresql84-contrib x86_64 8.4.13-1.el5_8 base 399 k
    postgresql84-server x86_64 8.4.13-1.el5_8 base 5.2 M
    Installing for dependencies:
    libxslt x86_64 1.1.17-4.el5_8.3 base 424 k
    postgresql84-libs x86_64 8.4.13-1.el5_8 base 211 k

    Transaction Summary
    ================================================================================
    Install 5 Package(s)
    Upgrade 0 Package(s)

    Total download size: 9.9 M
    Is this ok [y/N]:

    But when I hit y and enter I get this:

    Downloading Packages:
    http:///mrepo/rhel5-prod-x86_64/RPMS.os/postgresql84-libs-8.4.13-1.el5_8.x86_64.rpm: [Errno 14] HTTP Error 404: Not Found
    Trying other mirror.
    http:///mrepo/rhel5-prod-x86_64/RPMS.os/postgresql84-contrib-8.4.13-1.el5_8.x86_64.rpm: [Errno 14] HTTP Error 404: Not Found
    Trying other mirror.
    http:///mrepo/rhel5-prod-x86_64/RPMS.os/libxslt-1.1.17-4.el5_8.3.x86_64.rpm: [Errno 14] HTTP Error 404: Not Found
    Trying other mirror.
    http://puppet.unica.net/mrepo/rhel5-prod-x86_64/RPMS.os/postgresql84-8.4.13-1.el5_8.x86_64.rpm: [Errno 14] HTTP Error 404: Not Found
    Trying other mirror.
    http:///mrepo/rhel5-prod-x86_64/RPMS.os/postgresql84-server-8.4.13-1.el5_8.x86_64.rpm: [Errno 14] HTTP Error 404: Not Found
    Trying other mirror.

    Error Downloading Packages:
    postgresql84-contrib-8.4.13-1.el5_8.x86_64: failure: postgresql84-contrib-8.4.13-1.el5_8.x86_64.rpm from base: [Errno 256] No more mirrors to try.
    postgresql84-8.4.13-1.el5_8.x86_64: failure: postgresql84-8.4.13-1.el5_8.x86_64.rpm from base: [Errno 256] No more mirrors to try.
    postgresql84-libs-8.4.13-1.el5_8.x86_64: failure: postgresql84-libs-8.4.13-1.el5_8.x86_64.rpm from base: [Errno 256] No more mirrors to try.
    postgresql84-server-8.4.13-1.el5_8.x86_64: failure: postgresql84-server-8.4.13-1.el5_8.x86_64.rpm from base: [Errno 256] No more mirrors to try.
    libxslt-1.1.17-4.el5_8.3.x86_64: failure: libxslt-1.1.17-4.el5_8.3.x86_64.rpm from base: [Errno 256] No more mirrors to try.

    Reply
  2. Is it possible to have postgresql installed in a different directory?

    Reply

Trackbacks/Pingbacks

  1. Fedora NetInstall (Net Install) with gPXE and BFO (boot.fedoraproject.org) | If Not True Then False - [...] Fedora 13Install Adobe (Acrobat PDF) Reader on Fedora 13Install VirtualBox (with yum) on Fedora 13Install PostgreSQL 8.4 Database Server …
  2. Upgrade to Fedora 13 from Fedora 12 with Preupgrade - [...] Fedora 13Install Adobe (Acrobat PDF) Reader on Fedora 13Install VirtualBox (with yum) on Fedora 13Install PostgreSQL 8.4 Database Server …
  3. cannot create database in postgreSQL please help - oBlurb - [...] http://www.if-not-true-then-false.co…edora-red-hat/ [...]

Submit a Comment

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 class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">