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: mirrors.hostemo.com
 * epel: ftp.riken.jp
 * extras: mirrors.hostemo.com
 * updates: mirrors.hostemo.com
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: libpq.so.5 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
====================================================================================================
Installing:
 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

Installed:
  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

Complete!

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

As always if you need any help you can reach us on twitter @ehowstuff or drop us a comment below. Jumping through archives page to read more articles..

Related Articles

Leave a Reply