Installing GDAL on Uberspace 7

Time 2 minute read
GDAL on Uberspace 7
GDAL on Uberspace 7

I was pleasantly surprised to find out that Uberspace πŸš€ now has lots of precompiled extensions for PostgreSQL 🐘. And among them is PostGIS πŸ—ΊοΈ! There’s also a dedicated section in the installation manual. That’s pretty handy, if you want to store spatial data in your database. But how do you import spatial data? You can’t always rely on shp2pgsql. We need some proper ogr2ogr. We need GDAL!

Here are the steps to install GDAL on Uberspace 7. This is heavily based on Alex Bilz' tutorial, but updated for recent versions, especially of Proj and GDAL itself.

As of writing this post, Uberspace hosts a relatively old version of CMAKE (2.8.x), but in order to compile Proj and GDAL, we need at least version 3.4.

bash --skip-license --prefix=$HOME
hash -r

# Test
cmake --version
cmake version 3.17.3
mkdir geos && cd geos
curl -O
tar -vxf geos-3.11.1.tar.bz2
cd geos-3.11.1
./configure --prefix=$HOME/opt/geos/build --enable-python
make && make install

# Test
opt/geos/build/bin/geos-config --version
cd ~
mkdir proj && cd proj
curl -O
tar -vxf proj-9.1.1.tar.gz
cd proj-9.1.1
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/opt/proj
cmake --build .
cmake --build . --target install

# Test
Rel. 9.1.1, December 1st, 2022

Note: I ran into trouble while compiling Proj, or, to be more precise: I ran out of memory. If you see that the compiling process gets killed, you probably need to disable some currently running processes using supervisorctl stop.

cd ~
mkdir gdal && cd gdal
curl -O
tar -xvf gdal-3.6.2.tar.gz
cd gdal-3.6.2
mkdir build && cd build
cmake .. \
  -DPROJ_INCLUDE_DIR=$HOME/opt/proj/include \
  -DPROJ_LIBRARY_RELEASE=$HOME/opt/proj/lib64/ \
  -DGEOS_INCLUDE_DIR=$HOME/opt/geos/build/include \
  -DGEOS_LIBRARY=$HOME/opt/geos/build/lib64/ \

I needed to change the LD_LIBRARY_PATH environment variable so that it picks up Proj’s lib files. Just make a couple of adjustments to your .bash_profile.

vi ~/.bash_profile

export PROJ_DATA


source ~/.bash_profile

opt/gdal/bin/gdalinfo --version
GDAL 3.6.2, released 2023/01/02 (debug build)

That was a lot of source files. Time to remove them!

rm -rf ~/geos ~/proj ~/gdal

Share Social Interact With This Post At: Logo Mastodon Mastodon Logo Twitter Twitter
Calendar Posted:
Person Posted By:
Folder Open Categories: Tutorials Spatial Stuff
Pricetags Tags: GDAL GEOS Proj CMAKE OGR Uberspace



@chringel we'd love that in the Lab so others can find it more easily 😁 βš›οΈ Uberlab β€” UberLab 7 documentation