Install Postgresql 9.6 on Centos 7

Get correct RPM from http://yum.postgresql.org/repopackages.php, then download rpm with wget and install with rpm -i

# install EPEL repos:
wget https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
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
exit

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

nano /var/lib/pgsql/9.6/data/pg_hba.conf
# host    all             all             127.0.0.1/32            md5
# host    all             all             0.0.0.0/0               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

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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