How to Install PostgreSQL Database Server on Linux CentOS 6.2 Server

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. Follow these steps to install PostgreSQL database server on linux CentOS 6.2.

1. Run the following command to install PostgreSQL Server and it’s related package :

[root@centos62 ~]# yum install postgresql-server postgresql -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base:
 * epel:
 * extras:
 * updates:
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package postgresql.i686 0:8.4.9-1.el6_1.1 will be installed
--> Processing Dependency: postgresql-libs(x86-32) = 8.4.9-1.el6_1.1 for package: postgresql-8.4.9-1.el6_1.1.i686
--> Processing Dependency: for package: postgresql-8.4.9-1.el6_1.1.i686
---> Package postgresql-server.i686 0:8.4.9-1.el6_1.1 will be installed
--> Running transaction check
---> Package postgresql-libs.i686 0:8.4.9-1.el6_1.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

 Package                   Arch         Version                  Repository                    Size
 postgresql                i686         8.4.9-1.el6_1.1          CentOS6.2-Repository         2.7 M
 postgresql-server         i686         8.4.9-1.el6_1.1          CentOS6.2-Repository         3.3 M
Installing for dependencies:
 postgresql-libs           i686         8.4.9-1.el6_1.1          CentOS6.2-Repository         201 k

Transaction Summary
Install       3 Package(s)

Total download size: 6.2 M
Installed size: 28 M
Downloading Packages:
Total                                                                50 MB/s | 6.2 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : postgresql-libs-8.4.9-1.el6_1.1.i686                                             1/3
  Installing : postgresql-8.4.9-1.el6_1.1.i686                                                  2/3
  Installing : postgresql-server-8.4.9-1.el6_1.1.i686                                           3/3

  postgresql.i686 0:8.4.9-1.el6_1.1             postgresql-server.i686 0:8.4.9-1.el6_1.1

Dependency Installed:
  postgresql-libs.i686 0:8.4.9-1.el6_1.1


2. Check PostgreSQL status :

[root@centos62 ~]# service postgresql status
postmaster is stopped

3. On Linux CentOS 6.2, you have to initialize PostgreSQL database first before starting postgresql server. Please type the following command :

[root@centos62 ~]# service postgresql initdb
Initializing database:                                     [  OK  ]

4. Start PostgreSQL server :

[root@centos62 ~]# service postgresql start
Starting postgresql service:                               [  OK  ]

Turn on and off whether PostgreSQL starts at boot :

[root@centos62 ~]# chkconfig postgresql on

We will be happy to see your thoughts

Leave a reply