Install Postgresql 9.6 on Centos 7

Get correct RPM from, then download rpm with wget and install with rpm -i

# install EPEL repos:
rpm -ivh epel-release-7-11.noarch.rpm

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

export PGSETUP_INITDB_OPTIONS="--pgdata=/var/lib/pgsql/9.6/data/ -E 'UTF-8' --lc-collate='en_US.UTF-8' --lc-ctype='en_US.UTF-8'"

/usr/pgsql-9.6/bin/postgresql96-setup initdb 

systemctl start postgresql-9.6.service
systemctl enable postgresql-9.6.service

passwd postgres

su postgres
psql -c "ALTER USER postgres WITH PASSWORD 'xxxxxx'" -d template1

nano /var/lib/pgsql/9.6/data/postgresql.conf
# listen_addresses='*'

nano /var/lib/pgsql/9.6/data/pg_hba.conf
# host    all             all               md5
# host    all             all                  md5

systemctl restart postgresql-9.6.service

# Open firewall ports:
firewall-cmd --zone=dmz --add-port=5432/tcp --permanent
firewall-cmd --zone=public --add-port=5432/tcp --permanent
firewall-cmd --reload


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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s