PostGIS is an open source PostgreSQL database extension for creating Geographic objects on the PostgreSQL object relational database. The features of PostGIS are derived from Open Geospatial Consortium SQL specifications.

1 Installation

Before start make sure you have installed the EPEL Release

yum install epel-release

After the installation of PostgreSQL and adding EPEL repository, proceed to install PostGIS from the PostgreSQL added. The repository was added using command like below:

yum -y install

Enable EPEL and PowerTools repositories:

sudo dnf -y install
sudo dnf install dnf-plugins-core
sudo dnf config-manager --set-enabled powertools

Disable default PostgreSQL AppStream repository.

sudo dnf -qy module disable postgresql

Now, you can install the PostGIS by running the following command:

dnf install postgis30_12

The number 30 of postgis30_12 refers to version of postgis and the 12 for PostgreSQL 12

Once the installation has been completed, you can verify the PostGIS package with the following command:

rpm -qi postgis30_12

You should get the following output:

Name        : postgis30_12
Version     : 3.0.3
Release     : 8.rhel8
Architecture: x86_64
Install Date: Sun Apr 18 23:09:44 2021
Group       : Unspecified
Size        : 34636916
License     : GPLv2+
Signature   : DSA/SHA1, Sun Mar 28 23:32:57 2021, Key ID 1f16d2e1442df0f8
Source RPM  : postgis30_12-3.0.3-8.rhel8.src.rpm
Build Date  : Sun Mar 28 23:31:09 2021
Build Host  : koji-rhel8-x86-64-pgbuild
Relocations : (not relocatable)
Vendor      : PostgreSQL Global Development Group
URL         :
Summary     : Geographic Information Systems Extensions to PostgreSQL
Description :
PostGIS adds support for geographic objects to the PostgreSQL object-relational
database. In effect, PostGIS "spatially enables" the PostgreSQL server,
allowing it to be used as a backend spatial database for geographic information
systems (GIS), much like ESRI's SDE or Oracle's Spatial extension. PostGIS
follows the OpenGIS "Simple Features Specification for SQL" and has been
certified as compliant with the "Types and Functions" profile.

2 Create an extension

At this point, PostgreSQL and PostGIS have been installed. Now, you will need to create an extension for PostGIS.

First, login to Postgres user with the following command:

su - postgres

Next, create a postgres user and database with the following command: Only for testing

createuser usr_postgis
createdb test_postgis -O usr_postgis

Next, create a PostGIS extension with the following command:


Next, you can verify the PostGIS version using the following command:

select PostGIS_Full_Version();

3 Troubleshooting