Install Postgresql 9.6 on CentOS 6

# Get correct RPM from

cd /home/
mkdir installers
cd installers


rpm -i pgdg-centos96-9.6-3.noarch.rpm

# Install EPEL repos as:

rpm -ivh epel-release-6-8.noarch.rpm

yum install postgresql96 postgresql96-contrib postgresql96-server postgresql96-devel postgresql96-plpython postgis2_96 postgis2_96-devel postgis2_96-client postgis2_96-utils

service postgresql-9.6 initdb 'en_US.UTF8'
# or
# service postgresql-9.6 initdb 'es_ES.UTF-8'

chkconfig postgresql-9.6 on

# Darle password al usuario postgres linux/db:

passwd postgres
service postgresql-9.6 restart
su postgres
psql -c "ALTER USER postgres WITH PASSWORD 'xxxxxx'" -d template1

nano /var/lib/pgsql/9.6/data/postgresql.conf

# En la línea #listen_addresses quitamos el carácter # (habilitar) y reemplazamos la palabra localhost por el carácter *
# Configure la cantidad máxima de conexiones (max_connection) a 200.
# Guarde y cierre el archivo con Crtl+o, Enter, y Ctrl+x

nano /var/lib/pgsql/9.6/data/pg_hba.conf

# Definir en la seccion #IPv4 local connections :
host    all             all               password
host    all             all                  password

service postgresql-9.6 restart

# firewall rule for 5432 port
nano /etc/sysconfig/iptables
# Then add this entry before -A INPUT -j REJECT line
-A INPUT -p tcp -m state --state NEW -m tcp --dport 5432 -j ACCEPT
# restart firewall
service iptables restart
# verify open ports:
netstat -tulpn
# Make sure iptables is allowing port 80 / 110 / 143 connections:
iptables -L -n

# Disable enforce
nano /etc/selinux/config
# change the SELINUX line to 


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s