Simple step to Install and configure PostgreSQL in CentOS 6.6 

PostgreSQL  is a powerful, open-source object-relational database system. It runs under all major operating systems, including Linux, UNIX (AIX, BSD, HP-UX, SGI IRIX, Mac OS, Solaris, Tru64), and Windows OS.

Install PostgreSQL

Go to the PostgreSQL repository download page , and add the PostgreSQL 9.3 repository depending upon your server architecture.

For CentOS 6.x 32bit:
# rpm -Uvh

For CentOS 6.x 64bit:
# rpm -Uvh

For CentOS 7 64bit:
# rpm -Uvh

Now, Install postgresql with the following command:

# yum install  postgresql93-server.x86_64 postgresql93-contrib

Initialize postgresql database using following command: (Only for First time)

On CentOS 6.x systems:
# service postgresql-9.3 initdb

On CentOS 7 systems:
# /usr/pgsql-9.3/bin/postgresql93-setup initdb

Then, start postgresql service and make it to start automatically on every reboot.

On CentOS 6.x systems:

# service postgresql-9.3 start
# chkconfig postgresql-9.3 on

On CentOS 7 systems:

# systemctl enable postgresql-9.3
# systemctl start postgresql-9.3

Access PostgreSQL command prompt

The default database name and database user are “postgres”. Switch to postgres user to perform postgresql related operations:

# su - postgres
To login to postgresql, enter the command:

# psql
Sample Output:

psql (9.3.5)
Type "help" for help.


To exit from posgresql prompt, type \q following by quit to return back to the Terminal.

Set “postgres” user password
Login to postgresql prompt,

# su - postgres

# psql
.. and set postgres password with following command:

postgres=# \password postgres
Enter new password:
Enter it again:
postgres=# \q
Maintained By Amit Maheshwari