Install PostgreSQL 9.3 on CentOS 7
Autor: Carlos Eduardo | Publicado: 2014-11-17T05:08:00-08:00

 Open Terminal ( Applications —&gt; System Tools —&gt; Terminal). Switch to root user.  [raj@itzgeek~/]$ su -  Dependency:rpm -Uvh ftp://ftp.muug.mb.ca/mirror/centos/7.0.1406/os/x86_64/Packages/uuid-1.6.2-26.el7.x86_64.rpmInstall PosgreSQL 9.1.3: PostgreSQL publishes rpm packages for all Linux platforms, their  packages are generally fresher than those in the other repository. We  need to add the repository on our machine by installing repo rpm.  [root@itzgeek~/]# rpm -Uvh http://yum.postgresql.org/9.3/redhat/rhel-7-x86_64/pgdg-centos93-9.3-1.noarch.rpm  Install PostgreSQL 9.3.1&nbsp;, enable only PostgreSQL repository to install.  [root@itzgeek~/]# &nbsp;yum install postgresql93 postgresql93-server postgresql93-libs postgresql93-contrib postgresql93-devel --disablerepo=* --enablerepo=pgdg93  Configuring PostgreSQL 9.3.1 server: Initialize the PostgreSQL.  [root@itzgeek~/]# /usr/pgsql-9.3/bin/postgresql93-setup initdb  PostgreSQL normally listens on the localhosts only, if would you like  to enable the PostgreSQL to listen on all ip addresses; edit the  /var/lib/pgsql/9.1/data/postgresql.conf .  [root@itzgeek~/]# vi /var/lib/pgsql/9.3/data/postgresql.conf  Go to Connections and Communications section, find the  "listen_address" variable. Uncomment the "listen_addresses" and place  "*" instead of "localhost" Before editing:  #listen_addresses = "localhost"  After editing:  listen_addresses = "*"  Add your network to access database remotely; Edit&nbsp; /var/lib/pgsql/9.3/data/pg_hba.conf.  [root@itzgeek~/]# &nbsp;vi /var/lib/pgsql/9.3/data/pg_hba.conf  Add the following line according to your network configuration with  md5 password authentication (Enable remote access of database).  # IPv4 local connections: host&nbsp;&nbsp;&nbsp; all&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; all&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 127.0.0.1/32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; md5 host&nbsp;&nbsp;&nbsp; all&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; all&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 107.155.94.0/24&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; md5 # IPv6 local connections: host&nbsp;&nbsp;&nbsp; all&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; all&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ::1/128&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; md5  Restart the PostgreSQL server.  [root@itzgeek~/]# systemctl start postgresql-9.3.service  Confirm the PostgreSQL listening.  [root@itzgeek ~/]# netstat -antup | grep 5432 tcp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0 0.0.0.0:5432&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.0.0.0:*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LISTEN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 39620/postgres tcp6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0 :::5432&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :::*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LISTEN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 39620/postgres  Auto start the service on startup.  [root@itzgeek~/]# systemctl enable postgresql-9.3.service  Creating Database: Login as postgres user.  [root@geeksite~/]$ su -l postgres  create the database called "test"  -bash-4.2$ createdb test  Login into the database.  -bash-4.2$ psql test  Create a new user called "raj" to manage the databases.  test=# CREATE USER raj WITH SUPERUSER LOGIN PASSWORD 'raj';  Login with the superuser.  sam@geeksite~/$ psql -h localhost -d test -U raj  That's all!. You have successfully installed the PostgreSQL 9.3 on CentOS 7 / RHEL 7.