Tuesday, January 21, 2014

Install PostgreSQL 9.3 on CentOS, RHEL and Fedora

PostgreSQL is a open source object-relational, highly scalable, SQL compliant database management system. PostgreSQL is developed at the University of California at Berkeley Computer Science Department. This article will help you for installing PostgreSQL on CentOS, RHEL and Fedora Systems.
Step 1: Add PostgreSQL Yum Repository
First step is to install postgres repository in your system, Use one of below commands as per your system architecture and operating system.
CentOS/RHEL 5, 32-Bit:
# rpm -Uvh http://yum.postgresql.org/9.3/redhat/rhel-5-i386/pgdg-centos93-9.3-1.noarch.rpm

CentOS/RHEL 5, 64-Bit:
# rpm -Uvh http://yum.postgresql.org/9.3/redhat/rhel-5-x86_64/pgdg-centos93-9.3-1.noarch.rpm

CentOS/RHEL 6, 32-Bit:
# rpm -Uvh http://yum.postgresql.org/9.3/redhat/rhel-6-i386/pgdg-redhat93-9.3-1.noarch.rpm

CentOS/RHEL 6, 64-Bit:
# rpm -Uvh http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-redhat93-9.3-1.noarch.rpm

Fedora 19, 64-Bit:
# rpm -Uvh http://yum.postgresql.org/9.3/fedora/fedora-19-x86_64/pgdg-fedora93-9.3-1.noarch.rpm

Fedora 18, 64-Bit:
# rpm -Uvh http://yum.postgresql.org/9.3/fedora/fedora-18-x86_64/pgdg-fedora93-9.3-1.noarch.rpm

Fedora 18, 32-Bit:
# rpm -Uvh http://yum.postgresql.org/9.3/fedora/fedora-18-i386/pgdg-fedora93-9.3-1.noarch.rpm
Step 2: Install PostgreSQL Server
Use following command to install PostgreSQL on your system with yum package manager.
# yum install postgresql93-server postgresql93
Step 3: Initialize PGDATA
After installing PostgreSQL server, It’s required to initialize it before using first time. To initialize database use below command.
# /etc/init.d/postgresql-9.3 initdb

In some cases above commands doesn't work, Then use following command.

# /usr/pgsql-9.3/bin/postgresql93-setup initdb
Above command will take some time to initialize PostgreSQL first time. PGDATA environment variable contains path of data directory.
PostgreSQL data directory Path: /var/lib/pgsql/9.3/data/
Step 4: Start PostgreSQL Server
Start PostgreSQL service using following command.
# service postgresql-9.3 start
Setup PostgreSQL service to auto start on system boot.
# chkconfig postgresql-9.3 on
Step 5: Verify PostgreSQL Installation
After completing step 4, we have installed postgres 9.3 on server, Let do a basic test to verify that installation completed successfully. To verify switch to postgres user.
# su - postgres
Use psql command to access PostgreSQL prompt with admin privileges.
$ psql

psql (9.3.1)
Type "help" for help.

postgres=#
Congratulation’s! You have successfully installed PostgreSQL Server. Read below article to install phpPgAdmin.
How to Install phpPgAdmin on CentOS using Yum
New Features in PostgreSQL 9.3
  • 1 Configuration directive ‘include_dir’
  • 2 COPY FREEZE for more efficient bulk loading
  • 3 Custom Background Workers
  • 4 Data Checksums
  • 5 JSON: Additional functionality
  • 6 LATERAL JOIN
  • 7 Parallel pg_dump for faster backups
  • 8 ‘pg_isready’ server monitoring tool
  • 9 Switch to Posix shared memory and mmap()
  • 10 Trigger Features
    • 10.1 Event Triggers
  • 11 VIEW Features
    • 11.1 Materialized Views
    • 11.2 Recursive View Syntax
    • 11.3 Updatable Views
  • 12 Writeable Foreign Tables
    • 12.1 postgres_fdw
  • 13 Replication Improvements
    • 13.1 Streaming-Only Remastering
    • 13.2 Fast Failover
    • 13.3 Architecture-Independent Streaming
    • 13.4 pg_basebackup conf setup
  • 14 Backward compatibility
    • 14.1 CREATE TABLE output
    • 14.2 Server settings
    • 14.3 WAL filenames may end in FF

Thanks for using this tutorial for installting PostgreSQL on CentOS 5/6 and RHEL 5/6 systems.

No comments:

Post a Comment