Skip to content

Instantly share code, notes, and snippets.

@ahmedbaig
Last active November 9, 2021 09:03
Show Gist options
  • Save ahmedbaig/e7e5f04c9a8d409b0036db5f8de75169 to your computer and use it in GitHub Desktop.
Save ahmedbaig/e7e5f04c9a8d409b0036db5f8de75169 to your computer and use it in GitHub Desktop.
Installing MobilityDB on Postgres 13 Postgis 3

Add PostgreSQL 13 repository to Ubuntu 20.04

sudo apt update
sudo apt -y upgrade
sudo apt -y install vim bash-completion wget
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

You can now add the repository to your source list

echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee  /etc/apt/sources.list.d/pgdg.list

You might need to change your /etc/apt/sources.list if you get any dependancy issues to install some packages that are not available in Ubuntu 20

deb http://security.ubuntu.com/ubuntu bionic-security main 
deb http://cz.archive.ubuntu.com/ubuntu bionic main 
deb http://cz.archive.ubuntu.com/ubuntu bionic main universe

Installing Postgres 13, Client 13 and Postgis 3

sudo apt install postgresql-13 postgresql-client-13 postgres-13-postgis-3
# Checking running clusters
pg_lsclusters
systemctl status postgresql@13-main.service

Make and install mobilityDB

Click here for more details

cd /tmp/

DIR=mobility
VERSION=v1.0-beta4

wget https://github.com/MobilityDB/MobilityDB/archive/refs/tags/${VERSION}.tar.gz 
mkdir ${DIR}-${VERSION} && cd ${DIR}-${VERSION}

echo "Extracting the tar ball"

tar xvfz MobilityDB-1.0.tar.gz
cd MobilityDB-1.0
				
echo "To compile assuming you have all the dependencies in your search path"

mkdir build
cd build
cmake  ..
make
sudo make install

Connect to your DB and install the extensions needed

psql -h localhost -U postgres

psql (13.4 (Ubuntu 13.4-4.pgdg18.04+1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)

postgres=#CREATE DATABASE mobility
postgres=#\c mobility
mobility=#CREATE EXTENSION postgis;
mobility=#CREATE EXTENSION MobilityDB; 

Troubleshooting

Error Case 1

If you get this error

ERROR:  could not access file "$libdir/postgis-3": No such file or directory

try reinstalling the postgres-13-postgis-3 package again

Error Case 2

If you're installing mobility and you get the error

CMake Error at cmake/FindPOSTGIS.cmake:35 (message):
  No PostGIS library have been found

You need to check if you've added the POSTGIS extension to your mobility databse in postgres

Error Case 3

If you're installing mobility and you get the error

CMake Error at cmake/FindGEOS.cmake:200 (MESSAGE):
  Could not find GEOS

Run this

sudo apt update && sudo apt upgrade -y
sudo apt install libgeos++-dev libgeos-3.8.0 libgeos-c1v5 libgeos-dev libgeos-doc

Error Case 4

If you're installing mobility and you get the error

CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find GSL (missing: GSL_INCLUDE_DIR GSL_LIBRARY GSL_CBLAS_LIBRARY)

Run this

sudo apt update && sudo apt upgrade -y
sudo apt-get install libgsl-dev
@ahmedbaig
Copy link
Author

So far stuck on this error

CMake Error at CMakeLists.txt:128 (math):
  math cannot parse the expression: " * 10 + ": syntax error, unexpected
  exp_TIMES (2).


-- POSTGIS_GEOS_VERSION: ERROR
-- JSON-C_INCLUDE_DIRS: /usr/include/json-c
-- JSON-C_LIBRARIES: /usr/lib/x86_64-linux-gnu/libjson-c.so
-- POSTGIS_PROJ_VERSION: 63
-- Substitution: /home/ahmedbaig/Encfs/DesicionLabs/MobilityDB-1.0-beta4/build/libMobilityDB-1.0.so
-- XZ_EXECUTABLE: /usr/bin/xz
-- XZCAT_EXECUTABLE: /usr/bin/xzcat
-- PROJECT_DOC_TARGETS = 
-- PROJECT_BUILD_LANGUAGES = en
-- PROJECT_BUILD_LANGUAGES_STRING = English

Looking for solutions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment