Monday, March 30, 2009

How to install RPMforge repo (SL5, CentOS5)

Go to https://rpmrepo.org/RPMforge/Using website, check the RPMforge user instruction:

rpm -Uhv http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

The rpmrepo.repo will be installed in /etc/yum.repos.d/ directory.

Install PostgreSQL from yum repo in Scientific Linux 5 or CentOS5

Install PostgreSQL from yum repo in Scientific Linux5 (CentOS5)

make sure you have a root privileges

1. check latest postgresql yum configure rpm url from

http://yum.pgsqlrpms.org/reporpms/repoview/


Once you get the url for the rpm, then

Under RedHat5 (Scientific Linux5)

rpm -Uvh http://yum.pgsqlrpms.org/reporpms/8.4/pgdg-redhat-8.4-1.noarch.rpm

Under CentOS5

rpm -Uvh http://yum.pgsqlrpms.org/reporpms/8.4/pgdg-centos-8.4-1.noarch.rpm

2. upgrad any old package (there are package dependencies, you can't simply remove them)
(Optional, it will be upgraded automatically when you do 'yum install postgresql' if the installed postgresql-libs is older)

yum list 'postgresql*'

#
# Installed Packages
# postgresql-libs.x86 8.1.11-1.el5_1.1 installed
#

yum upgrade postgresql-libs


3. install postgresql

yum install postgresql postgresql-server


4. initdb and start service

service postgresql initdb

service postgresql start

5. change the init postgresql password, stop the postgresql service first.

service postgresql stop
su - postgres

Then go to /var/lib/pgsql/data directory, and edit pg_hba.conf file. Change the host all all 127.0.0.1/32 md5 to trust. Exit the postgres user, su root privileges to start the postgresql service

service postgresql start
su - postgres

psql -d template1
template1=# ALTER USER postgres WITH PASSWORD 'yourpassword';
template1=\q

su root privileges to stop postgresql service again, and use postgres user, go to /var/lib/pgsql/data,

Change the line back to md5, su root privileges to restart postgresql service

service postgresql start

Now you get a latest postgresql server installed in your machine.