One of the easiest way to install software on Red Hat, Fedora, or CentOS Linux distributions is through yum. Its faster to use than GUI installers and it just requires entering the following command:
yum -y install postgresql postgresql-server php-pgsql
The versions of PostgreSQL that can be updated are 7.3 to 8.3 and is available for Fedora (versions 7 and 8), Red Hat Enterprise Linux (versions 3, 4, and 5), and CentOS (versions 3, 4, and 5). PostreSQL is available on the 32-bit and 64-bit x-86 architectures.
Before running this command, you need to add configuration settings to the yum repository, which can be found at /etc/yum.conf or alternately save the settings in a file in the /etc/yum.repos.d folder (i.e. name the settings for Fedora as fedora.repo).
Configuration File for Fedora
# Please change the PostgreSQL major release number , if you need.
[pgdg82]
name=PostgreSQL $releasever – $basearch
baseurl=http://yum.pgsqlrpms.org/8.2/fedora/fedora-$releasever-$basearch
enabled=1
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora

Configuration File for Red Hat and CentOS
# Please change the PostgreSQL major release number , if you need.
[pgdg82]
name=PostgreSQL 8.2 $releasever – $basearch
baseurl=http://yum.pgsqlrpms.org/8.2/redhat/rhel-$releasever-$basearch
enabled=1
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora

Starting PostgreSQL
Once the PostgreSQL is installed, you need to configure the operating system to automatically start it when the system is booted. This can be done through the Services command in the GUI, or at the command line with:
/sbin/chkconfig postgresql on
/sbin/service postgresql start

Testing the DBMS
You can check if the software was correctly installed by running it with the following commands:
su – postgres
psql template1

Setting Permissions
The access configuration file in /var/lib/pgsql/data/pg_hba.conf should be set to use “trust” instead of “identity” as follows:
local all all trust
You’ll need to restart the database service after making this change by:
/sbin/service postgresql restart

Translate ยป