Install PostgreSQL 9.0.x on CentOS

Posted on Tue 19 April 2011 in CentOS

This tutorial explains how to install PostgreSQL from the official PostgreSQL repository. This method allows you to install newer versions of PostgreSQL for example 9.0 if you need the newest cluster functionality delivered with upcoming PostgreSQL 9.1 you need to build the software manual as long as there is no 9.1 repository available.

If you want to install the stable 8.4 version delivered with CentOS I wrote this tutorial.

1. Download yum repository rpm for your arch and version you want to use:

http://yum.pgsqlrpms.org/reporpms/repoview/pgdg-centos.html
  1. install rpm file
rpm -i <file>.rpm
  1. modify CentOS Repository
vi /etc/yum.repos.d/CentOS-Base.repo

add this line:

exclude=postgresql*

should look like this:

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
exclude=postgresql*
  1. install PostgreSQL
yum install postgresql-server

5.initialize PostgreSQL-Database

service postgresql initdb
  1. start service
service postgresql start
  1. if you want postgresql to be started at boot time run this:
chkconfig --levels 35 postgresql on