Rocky Linux 9 is
finally out. Some repo names changed, so here is a short guide about installing PostgreSQL and PostGIS on Rocky Linux 9:
First, install EPEL and PostgreSQL repos:
dnf -y install epel-release
dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm
Then, enable CRB (Code Ready Builder) repo:
dnf -y config-manager --set-enabled crb
Disable PostgreSQL module (Rocky's own module)
dnf -qy module disable postgresql
Now, you can install PostgreSQL and PostGIS. The command below will also pull PostgreSQL 14 server as well:
dnf -y install postgis32_14
Initialize the cluster:
/usr/pgsql-14/bin/postgresql-14-setup initdb
Start service:
systemctl enable --now postgresql-14
Switch to postgres user:
su - postgres
Create a database:
createdb my_gis_db
Create PostGIS extension:
psql my_gis_db -c "CREATE EXTENSION postgis"
Check the status:
psql my_gis_db -c "SELECT postgis_full_version()"
postgis_full_version
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
POSTGIS="3.2.2 628da50" [EXTENSION] PGSQL="140" GEOS="3.10.3-CAPI-1.16.1" SFCGAL="1.4.1" PROJ="8.2.1" LIBXML="2.9.13" LIBJSON="0.14" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)"
(1 row)
Done! You can also create the following extensions as well:
- postgis_sfcgal
- postgis_raster
- postgis_tiger_geocoder
- postgis_topology
i.e.:
$ psql my_gis_db -c "CREATE EXTENSION postgis_topology"
CREATE EXTENSION
$ psql my_gis_db -c "CREATE EXTENSION postgis_raster"
CREATE EXTENSION
$ psql my_gis_db -c "SELECT postgis_full_version()"
postgis_full_version
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
POSTGIS="3.2.2 628da50" [EXTENSION] PGSQL="140" GEOS="3.10.3-CAPI-1.16.1" SFCGAL="1.4.1" PROJ="8.2.1" GDAL="GDAL 3.4.3, released 2022/04/22" LIBXML="2.9.13" LIBJSON="0.14" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)" TOPOLOGY RASTER
(1 row)
Enjoy!