====== 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 [[https://www.alexbilz.com/post/2020-08-18-install-postgis-on-uberspace/|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 [[https://manual.uberspace.de/database-postgresql/|manual]] and [[https://lab.uberspace.de/guide_postgresql.html| Uber Lab guide]] to get that going.
===== CMAKE =====
Some of the dependencies of PostGIS require ''cmake'' such as SFCGAL (as do the [[https://generic-mapping-tools.org|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 [[https://www.mpfr.org/|MPFR library]], [[https://www.mpfr.org/mpfr-current/mpfr.html#Installing-MPFR|install instructions]]
./configure --prefix=/home/glorida/opt/mpfr
[[https://doc.cgal.org/5.2.3/Manual/installation.html|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
[[https://gitlab.com/Oslandia/SFCGAL|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
===== PROJ Library =====
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