Monday, October 18, 2010

Install Postgresql 8.3 using YUM in CentOS 5

0 comments
In order to use Postgresql 8.3 using YUM in CentOS 5, pgdg repo configuration file can be used.
su - root
cd /etc/yum.repos.d
ls
C5base.repo   C5updates.repo   CentOS-Base.repo   CentOS-Media.repo

Download pgdg-centos-8.3-7.noarch from
yum.pgsqlrpms.org/reporpms/repoview/pgdg-centos.html.
rpm -ivh pgdg-centos-8.3-7.noarch
That is, I got  pgdg-83-centos.repo in my /etc/yum.repos.d and now I had to make sure yum installer use this repo configuration file for postgresql.

For this, I added
exclude=postgresql*
to the bottom of the each section of other repos in order to exclude distro packages.

vi C5base.repo
-------------------
[C5base]
name=C5base
baseurl=http://10.0.0.7/cobbler/repo_mirror/C5base
enabled=1
priority=1
gpgcheck=0
exclude=postgresql*
-------------------

vi CentOS-Base.repo
--------------------
[base]
name=CentOS-5 - Base
enabled=1
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=i386&repo=os
#baseurl=http://mirror.centos.org/centos/5/os/i386/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
priority=1
exclude=postgresql*

#released updates
[updates]
name=CentOS-5 - Updates
enabled=1
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=i386&repo=updates
#baseurl=http://mirror.centos.org/centos/5/updates/i386/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
priority=1
exclude=postgresql*
-------------------------
I checked that pgdg repo configuration file was using.
yum list postgres
...
Loading mirror speeds from cached hostfile
 * pgdg83: yum.pgrpms.org
...
postgresql.i386     8.3.12-1PGDG.rhel5
...
Everything was correct and I started Postgresql installation from yum.

yum install postgres
yum install postgres-server

adduser postgres
groupadd postgres
chown -R postgres:postgres /var/lib/pgsql
su - postgres
vi .bash_profile
----------------
...
export PGDATA=/var/lib/pgsql/data
...
----------------
Now, initdb is used in order to create postgresql cluster and other configuraton steps were followed according to the postgresql manual.

For reference, read the followings:
http://yum.pgrpms.org/howtoyum.php
http://www.postgresonline.com/journal/index.php?/archives/45-An-Almost-Idiots-Guide-to-PostgreSQL-YUM.html

Leave a Reply

Labels