How to Install PostgreSQL 9.2 on CentOS 6.3

This quick post shows the basic steps to install PostgreSQL Database Server (PostgreSQL 9.2) on CentOS 6.3. This steps has been tested using CentOS 6.3. However, It may works on other version CentOS or Redhat as well. PostgreSQL is a Sophisticated open-source Object-Relational DBMS supporting almost all SQL constructs, including subselects, transactions, and user-defined types. PostgreSQL is a powerful, open source object-relational database system that available for many platforms including Linux, FreeBSD, Solaris, Microsoft Windows and Mac OS X.

PostgreSQL Global Development Group (PGDG) builds RPMs for various Linux distributions. At the time of this writing, there are available RPMs and SRPMs for the following platforms :

  • PostgreSQL 9.2
See also  How to Install phpMyAdmin on Ubuntu 14.04

Follow these steps to install PostgreSQL 9.2 on CentOS 6.3 :

1. Download the latest production release for your distro here: http://yum.pgrpms.org/repopackages.php

[root@centos63 ~]# wget http://yum.pgrpms.org/9.2/redhat/rhel-6-i386/pgdg-centos92-9.2-5.noarch.rpm
--2012-09-25 21:50:05--  http://yum.pgrpms.org/9.2/redhat/rhel-6-i386/pgdg-centos92-9.2-5.noarch.rpm
Resolving yum.pgrpms.org... 98.129.198.114
Connecting to yum.pgrpms.org|98.129.198.114|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5220 (5.1K) [application/x-redhat-package-manager]
Saving to: âpgdg-centos92-9.2-5.noarch.rpmâ

100%[==========================================================>] 5,220       4.76K/s   in 1.1s

2012-09-25 21:50:06 (4.76 KB/s) - âpgdg-centos92-9.2-5.noarch.rpmâ

2. Install the repo :

[root@centos63 ~]# rpm -ivh pgdg-centos92-9.2-5.noarch.rpm
Preparing...                ########################################### [100%]
   1:pgdg-centos92          ########################################### [100%]

3. Edit the CentOS-Base.repo to exclude postgreql.

[root@centos63 ~]# vi /etc/yum.repos.d/CentOS-Base.repo

Add ‘exclude=postgresql*’ to the [base] and [updates] sections:

[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-6
exclude=postgresql*

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
exclude=postgresql*

4. Use ‘yum list’ to check the packages that are now available.

[root@centos63 ~]# yum list postgres*
Loaded plugins: fastestmirror, presto, priorities
Loading mirror speeds from cached hostfile
 * base: centos.ipserverone.com
 * extras: centos.ipserverone.com
 * updates: centos.ipserverone.com
Available Packages
postgresql.i686                              8.4.11-1.el6_2                     CentOS6.3-Repository
postgresql-contrib.i686                      8.4.11-1.el6_2                     CentOS6.3-Repository
postgresql-devel.i686                        8.4.11-1.el6_2                     CentOS6.3-Repository
postgresql-docs.i686                         8.4.11-1.el6_2                     CentOS6.3-Repository
postgresql-jdbc.i686                         8.4.701-3.el6                      CentOS6.3-Repository
postgresql-jdbc.noarch                       8.4.701-8.el6                      CentOS6.3-Repository
postgresql-libs.i686                         8.4.11-1.el6_2                     CentOS6.3-Repository
postgresql-odbc.i686                         08.04.0200-1.el6                   CentOS6.3-Repository
postgresql-plperl.i686                       8.4.11-1.el6_2                     CentOS6.3-Repository
postgresql-plpython.i686                     8.4.11-1.el6_2                     CentOS6.3-Repository
postgresql-pltcl.i686                        8.4.11-1.el6_2                     CentOS6.3-Repository
postgresql-server.i686                       8.4.11-1.el6_2                     CentOS6.3-Repository
postgresql-test.i686                         8.4.11-1.el6_2                     CentOS6.3-Repository
postgresql92.i686                            9.2.1-1PGDG.rhel6                  pgdg92
postgresql92-contrib.i686                    9.2.1-1PGDG.rhel6                  pgdg92
postgresql92-debuginfo.i686                  9.2.1-1PGDG.rhel6                  pgdg92
postgresql92-devel.i686                      9.2.1-1PGDG.rhel6                  pgdg92
postgresql92-docs.i686                       9.2.1-1PGDG.rhel6                  pgdg92
postgresql92-libs.i686                       9.2.1-1PGDG.rhel6                  pgdg92
postgresql92-odbc.i686                       09.01.0200-1PGDG.rhel6             pgdg92
postgresql92-odbc-debuginfo.i686             09.01.0200-1PGDG.rhel6             pgdg92
postgresql92-plperl.i686                     9.2.1-1PGDG.rhel6                  pgdg92
postgresql92-plpython.i686                   9.2.1-1PGDG.rhel6                  pgdg92
postgresql92-pltcl.i686                      9.2.1-1PGDG.rhel6                  pgdg92
postgresql92-server.i686                     9.2.1-1PGDG.rhel6                  pgdg92
postgresql92-tcl.i686                        2.0.0-1.rhel6                      pgdg92
postgresql92-tcl-debuginfo.i686              2.0.0-1.rhel6                      pgdg92
postgresql92-test.i686                       9.2.1-1PGDG.rhel6                  pgdg92

5. Start install PostgreSQL 9 using yum:

[root@centos63 ~]# yum install postgresql92 postgresql92-devel postgresql92-server postgresql92-libs postgresql92-contrib -y

6. Verify, Initialize and Start PostgreSQL service :

[root@centos63 ~]# service postgresql-9.2 status
 is stopped
[root@centos63 ~]# service postgresql-9.2 initdb
Initializing database:                                     [  OK  ]
[root@centos63 ~]# service postgresql-9.2 start
Starting postgresql-9.2 service:                           [  OK  ]

How to Reset the Directory Manager Password on RHEL 7 / CentOS 7
How to Reset the Directory Manager Password on RHEL 7 / CentOS 7

It is best practice to remember passwords, but because too many passwords, sometimes we forget. We are not encouraged to write the password on any paper or share the password...

How to Find Big Files Size on Linux RHEL/CentOS
How to Find Big Files Size on Linux RHEL/CentOS

As the linux administrator, sometimes we have to identify which files are most take much space in the linux server resulting in low free space. Low disk space can also...

Why Linux users should worry about malware and what they can do about it
Why Linux users should worry about malware and what they can do about it

Don’t drop your guard just because you’re running Linux. Preventing the spread of malware and/or dealing with the consequences of infection are a fact of life when using computers. If...

How to Reset Forgotten Root Password on Linux RHEL 7 / CentOS 7
How to Reset Forgotten Root Password on Linux RHEL 7 / CentOS 7

This short howto will explain the steps to reset a lost root password or to reset a forgotten root password on Linux RHEL 7 or CentOS 7. Basically, we will...

How to Update CentOS or Upgrade CentOS to the Latest Version
How to Update CentOS or Upgrade CentOS to the Latest Version

Recently, the latest version of CentOS 7.3 was released. All users of CentOS 7.0, 7.1 and 7.2 can upgrade their system to the most recent. This quick guide will explain...

How to Change your WordPress Username, Nickname and Display Name in MySQL
How to Change your WordPress Username, Nickname and Display Name in MySQL

After you create an account log in WordPress, you may want to change your WordPress username, as appropriate or due to security reason. However, you can not do this from...

How to Enable SSH Root Login on Ubuntu 16.04
How to Enable SSH Root Login on Ubuntu 16.04

As what we wrote in the previous article on how to allow SSH root on Ubuntu 14.04, after installing a fresh new copy of Ubuntu 16.04 LTS, we find that...

How to Change UUID of Linux Partition on CentOS 7
How to Change UUID of Linux Partition on CentOS 7

UUID (Universally Unique IDentifier) should be unique and it is used to identify storage devices on a linux system. If you cloned a virtual machine from vCenter, the metadata containing...

Leave a Reply

Your email address will not be published. Required fields are marked *