Postgresql 12 and PostGIS 3.x on UberSpace U7

This is a short description to get PostgreSQL v12 spatially enabled on [https://uberspace.de|Uberspace's]] U7. This is partly based on the guide Alexander Bilz has on his website but with some tweaks.

When following the Uberspace lab/manual for installing PostgreSQL, your installation is going to live in $HOME/opt/postgresql, I will therefore use the $HOME/opt directory for installing the additional dependencies for PostGIS.

Enable Postgresql version 12 (or others - in this guide I will use PGSQL v12) in your U7 - follow the manual and Uber Lab guide to get that going.

CMAKE

Some of the dependencies of PostGIS require cmake such as SFCGAL (as do the Generic mapping tools which will also be used):

wget https://github.com/Kitware/CMake/releases/download/v3.21.0/cmake-3.21.0-linux-x86_64.sh
sh cmake-3.21.0-linux-x86_64.sh && mv cmake-3.21.0-linux-x86_64 ~/bin/cmake

SFCGAL and dependencies

SFCGAL has a few dependencies:

The MPFR library, install instructions

 ./configure --prefix=/home/glorida/opt/mpfr

CGAL installation

mkdir build && cd build
 ~/bin/cmake-3.21.0-linux-x86_64/bin/cmake -DCMAKE_INSTALL_PREFIX=/home/glorida/opt/CGAL -DMPFR_INCLUDE_DIR=/home/glorida/opt/mpfr/include/  -DMPFR_LIBRARIES=/home/glorida/opt/mpfr/lib/ -DCGAL_HEADER_ONLY=OFF -DCMAKE_BUILD_TYPE=Release .. 
make
make install

SFCGAL

GEOS Library

~/bin/cmake-3.21.0-linux-x86_64/bin/cmake -DCMAKE_BUILD_TYPE=Release  --install-prefix=/home/glorida/opt/geos  .. ''
make && make install
<code>
 
===== PROJ Library =====
 
<code>
wget https://download.osgeo.org/proj/proj-8.1.0.tar.gz

GDAL

wget https://github.com/OSGeo/gdal/releases/download/v3.3.1/gdal-3.3.1.tar.gz

PostGIS

wget https://download.osgeo.org/postgis/source/postgis-3.1.3.tar.gz