How to install PostGIS on CentOS 8

How to install PostGIS on CentOS 8? This guide will guide you through the steps to install PostGIS on CentOS 8 Linux. PostGIS is a PostgreSQL database extension that allows GIS (Geographic Information System) objects to be stored in a database. PostGIS is an open source software that has been licensed under the Creative Commons Attribution-ShareAlike 3.0 license.

PostGIS supports GiST-based R-Tree spatial indexing and functions that help analyze and process GIS objects. Here are the core features of PostGIS.

Features of PostGIS

The PostGIS 2+ series provides:

  • Processing and analysis of vector and raster data, using the power of SQL for stitching, dicing, deformation, reclassification and collection / union
  • Raster map algebra for fine-grained raster processing
  • SQL and callable functions for spatial reprojection of vector and raster data
  • Support import / export of ESRI shapefile vector data through command line and GUI packaging tools, and support more formats through other third party open source tools
  • Packaged command line for importing raster data from multiple standard formats: GeoTiff, NetCDF, PNG, JPG, etc.
  • Render and import vector data using SQL for standard text formats (such as KML, GML, GeoJSON, GeoHash and WKT)
  • Use SQL to render raster data in various standard formats GeoTIFF, PNG, JPG, NetCDF
  • Seamless raster / vector SQL callable functions for stretching pixel values ​​by geometric region, running statistics by region, trimming rasters by geometry, and vectorizing rasters
  • 3D object support, spatial indexing and functionality
  • Network topology support
  • Packed Tiger Loader / Geocoder / Reverse Geocoder / Utilization U.S. Census Tiger Data

Please follow the steps below to install PostGIS on CentOS 8.

Step 1: Install the PostgreSQL database server

PostgreSQL is a dependency that uses PostGIS functionality. Use the following guide to install PostgreSQL on CentOS 8.

How to install PostgreSQL on CentOS 8

Step 2: Install PostGIS on CentOS 8

After installing PostgreSQL and adding the EPEL repository, proceed to install PostGIS from the added PostgreSQL. Added the repository with the following command:

sudo yum -y install

Enable EPEL and PowerTools repositories:

sudo dnf -y install
sudo dnf config-manager --set-enabled PowerTools

Disable the default PostgreSQL AppStream repository.

sudo dnf -qy module disable postgresql

Install PostGIS for PostgreSQL 12:

sudo yum install postgis25_12

If you are using PostgreSQL 11, run:

sudo yum install postgis25_11

hit ÿ Key to start the installation.

CentOS-8 - AppStream                                                                                                     12 kB/s | 4.3 kB     00:00    
CentOS-8 - Base                                                                                                          30 kB/s | 3.8 kB     00:00    
CentOS-8 - Extras                                                                                                        11 kB/s | 1.5 kB     00:00    
CentOS-8 - PowerTools                                                                                                   7.8 MB/s | 2.0 MB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                                                                           43 kB/s |  31 kB     00:00    
PostgreSQL 12 for RHEL/CentOS 8 - x86_64                                                                                 19 kB/s | 3.8 kB     00:00    
PostgreSQL 11 for RHEL/CentOS 8 - x86_64                                                                                 30 kB/s | 3.8 kB     00:00    
PostgreSQL 10 for RHEL/CentOS 8 - x86_64                                                                                8.1 kB/s | 3.8 kB     00:00    
PostgreSQL 9.6 for RHEL/CentOS 8 - x86_64                                                                                19 kB/s | 3.8 kB     00:00    
PostgreSQL 9.5 for RHEL/CentOS 8 - x86_64                                                                               7.3 kB/s | 3.8 kB     00:00    
PostgreSQL 9.4 for RHEL/CentOS 8 - x86_64                                                                               6.2 kB/s | 3.8 kB     00:00    
Dependencies resolved.
 Package                                        Architecture               Version                                 Repository                      Size
 postgis25_12                                   x86_64                     2.5.3-6.rhel8                           pgdg12                         4.4 M
Installing dependencies:
 blas                                           x86_64                     3.8.0-8.el8                             AppStream                      429 k
 boost-serialization                            x86_64                     1.66.0-6.el8                            AppStream                      128 k
 lapack                                         x86_64                     3.8.0-8.el8                             AppStream                      8.6 M
 mariadb-connector-c                            x86_64                     3.0.7-1.el8                             AppStream                      148 k
 mariadb-connector-c-config                     noarch                     3.0.7-1.el8                             AppStream                       13 k
 openblas                                       x86_64                     0.3.3-2.el8                             AppStream                      4.3 M
 openblas-threads                               x86_64                     0.3.3-2.el8                             AppStream                      4.4 M
 qt5-qtbase                                     x86_64                     5.11.1-7.el8                            AppStream                      3.3 M
 qt5-qtbase-common                              noarch                     5.11.1-7.el8                            AppStream                       39 k
 qt5-qtbase-gui                                 x86_64                     5.11.1-7.el8                            AppStream                      6.0 M
 qt5-qtsvg                                      x86_64                     5.11.1-2.el8                            AppStream                      182 k
 unixODBC                                       x86_64                     2.3.7-1.el8                             AppStream                      458 k
 xcb-util-image                                 x86_64                     0.4.0-9.el8                             AppStream                       21 k
 xcb-util-keysyms                               x86_64                     0.4.0-7.el8                             AppStream                       16 k
 xcb-util-renderutil                            x86_64                     0.3.9-10.el8                            AppStream                       19 k
 xcb-util-wm                                    x86_64                     0.4.1-12.el8                            AppStream                       32 k
 atlas                                          x86_64                     3.10.3-7.el8                            BaseOS                         6.5 M
 libgfortran                                    x86_64                     8.3.1-4.5.el8                           BaseOS                         638 k
 libquadmath                                    x86_64                     8.3.1-4.5.el8                           BaseOS                         169 k
 pcre2-utf16                                    x86_64                     10.32-1.el8                             BaseOS                         228 k
 SuperLU                                        x86_64                     5.2.0-7.el8                             PowerTools                     191 k
 libaec                                         x86_64                     1.0.2-3.el8                             PowerTools                      39 k
 libdap                                         x86_64                     3.19.1-2.el8                            PowerTools                     686 k
 openblas-openmp                                x86_64                     0.3.3-2.el8                             PowerTools                     4.4 M
 openblas-threads64_                            x86_64                     0.3.3-2.el8                             PowerTools                     4.3 M
 armadillo                                      x86_64                     9.700.2-1.el8                           epel                            38 k
 arpack                                         x86_64                     3.7.0-1.el8                             epel                           194 k
 cfitsio                                        x86_64                     3.47-1.el8                              epel                           577 k
 freexl                                         x86_64                     1.0.5-4.el8                             epel                            34 k
 hdf                                            x86_64                     4.2.14-5.el8                            epel                           651 k
 hdf5                                           x86_64                     1.10.5-4.el8                            epel                           2.1 M
 libgeotiff                                     x86_64                     1.5.1-1.el8                             epel                            99 k
 libgta                                         x86_64                     1.2.1-1.el8                             epel                            34 k
 netcdf                                         x86_64                     4.7.0-2.el8                             epel                           647 k
 ogdi                                           x86_64                     4.1.0-1.el8                             epel                           241 k
 xerces-c                                       x86_64                     3.2.2-3.el8                             epel                           991 k
 CGAL                                           x86_64                     4.14-1.rhel8                            pgdg12                         524 k
 SFCGAL                                         x86_64                     1.3.7-2.rhel8                           pgdg12                          19 k
 SFCGAL-libs                                    x86_64                     1.3.7-2.rhel8                           pgdg12                         1.9 M
 gdal30-libs                                    x86_64                     3.0.2-1.rhel8                           pgdg12                         7.3 M
 geos38                                         x86_64                     3.8.0-1.rhel8                           pgdg12                         643 k
 postgresql12-contrib                           x86_64                     12.1-2PGDG.rhel8                        pgdg12                         2.4 M
 proj62                                         x86_64                     6.2.1-1.rhel8                           pgdg12                         1.8 M

Transaction Summary
Install  44 Packages

Total download size: 70 M
Installed size: 338 M
Is this ok [y/N]: y

This will install PostGIS v2.5 for PostgreSQL 12.

$ rpm -qi postgis25_12
Name        : postgis25_12
Version     : 2.5.3
Release     : 6.rhel8
Architecture: x86_64
Install Date: Mon 20 Jan 2020 10:40:35 PM EAT
Group       : Unspecified
Size        : 29786216
License     : GPLv2+
Signature   : DSA/SHA1, Mon 04 Nov 2019 10:05:01 PM EAT, Key ID 1f16d2e1442df0f8
Source RPM  : postgis25_12-2.5.3-6.rhel8.src.rpm
Build Date  : Mon 04 Nov 2019 10:04:57 PM EAT
Build Host  : koji-rhel8-x86-64-pgbuild
Relocations : (not relocatable)
Vendor      : PostgreSQL Global Development Group
URL         :
Summary     : Geographic Information Systems Extensions to PostgreSQL
Description :

Step 3: Enable PostGIS Spatial

You need to activate the PostGIS function on the database before you can
Storage space data. The following example will show you how to create one
Database and activate the space function.

1.Switch to the postgres user.

sudo -i -u postgres

2.Create a test user / database.

-bash-4.2$ createuser test_user-bash-4.2$ createdb test_db -O test_user

3.Connect to the test database:

$ psql -d test_db
 psql (12.1)
 Type "help" for help.

4.Enable PostGIS extension on the database:


5. check

test_db=# SELECT PostGIS_version();             postgis_version            2.5 USE_GEOS=1 USE_PROJ=1 USE_STATS=1 (1 row)test_db=# q

Reference official PostGIS document For usage guide and advanced configuration.

This is an installation guide for other systems.

Install PostGIS on Ubuntu / Debian

Install PostGIS on CentOS 7