Sys Admin

Installing PostgreSQL 9.4 and PostGis on CentOS 7


Jan. 22, 2016

PostGis PostgreSQL CentOS

Centos 7 provides PostgreSQL 9.2 but we can upgrade to 9.4.

Hopefully provides RPMs for Centos 7.

First install these extra packages:

yum install
yum groupinstall "PostgreSQL Database Server 9.4 PGDG"

Note this package use an install prefix:



Thus we can run both in parallel.

If you have to stop PostgreSQL 9.2:

systemctl stop postgresql.service
systemctl disable postgresql.service

Then setup and enable PostgreSQL 9.4:

/usr/pgsql-9.4/bin/postgresql94-setup initdb
systemctl enable postgresql-9.4.service
systemctl start postgresql-9.4.service

To use PostGis, we have to compile it againt PostgreSQL 9.4. The package provided by EPEL is compiled againt 9.2 and is not aware of the prefix.

First install some dependencies:

yum install postgresql94-devel
yum install geos-devel.x86_64
yum install proj-devel.x86_64
yum install gdal-devel.x86_64
yum install libxml2-devel.x86_64
yum install json-c-devel.x86_64

Then compile PostGIS:

tar xvzf postgis-2.2.1.tar.gz
cd postgis-2.2.1
./configure --with-pgconfig=/usr/pgsql-9.4/bin/pg_config
make install