1.5. Installation

1.5.1. Short Version

To compile assuming you have all the dependencies in your search path

git clone https://github.com/MobilityDB/MobilityDB
mkdir MobilityDB/build
cd MobilityDB/build
cmake  ..
make
sudo make install

The above commands install the master branch. If you want to install another branch, for example, develop, you can replace the first command above as follows

git clone --branch develop https://github.com/MobilityDB/MobilityDB

You should also set the following in the postgresql.conf file depending on the version of PostGIS you have installed (below we use PostGIS 3):

shared_preload_libraries = 'postgis-3'
max_locks_per_transaction = 128

You can replace postgis-2.5 above if you want to use PostGIS 2.5.

If you do not preload the PostGIS library you will not be able to load the MobilityDB library and will get an error message such as the following one:

ERROR:  could not load library "/usr/local/pgsql/lib/libMobilityDB-1.0.so":
  undefined symbol: ST_Distance

Notice that you can find the location of the postgresql.conf file as given next.

$ which postgres
/usr/local/pgsql/bin/postgres
$ ls /usr/local/pgsql/data/postgresql.conf
/usr/local/pgsql/data/postgresql.conf

As can be seen, the PostgreSQL binaries are in the bin subdirectory while the postgresql.conf file is in the data subdirectory.

Once MobilityDB is installed, it needs to be enabled in each database you want to use it in. In the example below we use a database named mobility.

createdb mobility
psql mobility -c "CREATE EXTENSION PostGIS"
psql mobility -c "CREATE EXTENSION MobilityDB"

1.5.2. Get the Sources

The MobilityDB latest release can be found in https://github.com/MobilityDB/MobilityDB/releases/latest

wget

To download this release:

wget -O mobilitydb-1.0.tar.gz https://github.com/MobilityDB/MobilityDB/archive/v1.0.tar.gz

Go to Section 1.5.1 to the extract and compile instructions.

git

To download the repository

git clone https://github.com/MobilityDB/MobilityDB.git
cd MobilityDB
git checkout v1.0

Go to Section 1.5.1 to the compile instructions (there is no tar ball).

1.5.3. Enabling the Database

MobilityDB is an extension that depends on PostGIS. Enabling PostGIS before enabling MobilityDB in the database can be done as follows

CREATE EXTENSION postgis;
CREATE EXTENSION mobilitydb;

Alternatively, this can be done in a single command by using CASCADE, which installs the required PostGIS extension before installing the MobilityDB extension

CREATE EXTENSION mobilitydb CASCADE;

1.5.4. Dependencies

Compilation Dependencies

To be able to compile MobilityDB, make sure that the following dependencies are met:

  • GNU C compiler (gcc). Some other ANSI C compilers can be used but may cause problems compiling some dependencies such as PostGIS.

  • GNU Make (gmake or make) version 3.1 or higher. For many systems, GNU make is the default version of make. Check the version by invoking make -v.

  • PostgreSQL version 11 or higher. PostgreSQL is available from http://www.postgresql.org.

  • PostGIS version 2.5 or higher. PostGIS is available from https://postgis.net/.

  • GNU Scientific Library (GSL). GSL is available from https://www.gnu.org/software/gsl/. GSL is used for the random number generators.

Please notice that PostGIS has its own dependencies such as Proj4, GEOS, LibXML2, or JSON-C, and these libraries are also used in MobilityDB. For a full PostgreSQL/PostGIS support matrix and PostGIS/GEOS support matrix refer to http://trac.osgeo.org/postgis/wiki/UsersWikiPostgreSQLPostGIS.

Optional Dependencies

For the user's documentation

  • The DocBook DTD and XSL files are required for building the documentation. For Ubuntu, they are provided by the packages docbook and docbook-xsl.

  • The XML validator xmllint is required for validating the XML files of the documentation. For Ubuntu, it is provided by the package libxml2.

  • The XSLT processor xsltproc is required for building the documentation in HTML format. For Ubuntu, it is provided by the package libxslt.

  • The program dblatex is required for building the documentation in PDF format. For Ubuntu, it is provided by the package dblatex.

  • The program dbtoepub is required for building the documentation in EPUB format. For Ubuntu, it is provided by the package dbtoepub.

For the developers's documentation

  • The program doxygen is required for building the documentation. For Ubuntu, it is provided by the package doxygen.

Example: Installing dependencies on Linux

Database dependencies

sudo apt-get install postgresql-13 postgresql-server-dev-13 postgresql-13-postgis

Build dependencies

sudo apt-get install cmake gcc libgsl-dev

1.5.5. Configuring

MobilityDB uses the cmake system to do the configuration. The build directory must be different from the source directory.

To create the build directory

mkdir build

To see the variables that can be configured

cd build
cmake -L ..

1.5.6. Build and Install

Please notice that the current version of MobilityDB has only been tested on Linux systems. It may work on other UNIX-like systems, but remain untested. Support for Windows is planned. We are looking for volunteers to help us to test MobilityDB on multiple platforms.

The following instructions start from path/to/MobilityDB on a Linux system

mkdir build
cd build
cmake ..
make
sudo make install

When the configuration changes

rm -rf build

and start the build process as mentioned above.

1.5.7. Testing

MobilityDB uses ctest, the CMake test driver program, for testing. This program will run the tests and report results.

To run all the tests

ctest

To run a given test file

ctest -R '21_tbox'

To run a set of given test files you can use wildcards

ctest -R '22_*'

1.5.8. Documentation

MobilityDB user's documentation can be generated in HTML, PDF, and EPUB format. Furthermore, the documentation is available in English and in other languages (currently, only in Spanish). The user's documentation can be generated in all formats and in all languages, or specific formats and/or languages can be specified. MobilityDB developer's documentation can only be generated in HTML format and in English.

The variables used for generating user's and the developer's documentation are as follows:

VariableDefault valueComment
DOC_ALLBOOL=OFFThe user's documentation is generated in HTML, PDF, and EPUB formats.
DOC_HTMLBOOL=OFFThe user's documentation is generated in HTML format.
DOC_PDFBOOL=OFFThe user's documentation is generated in PDF format.
DOC_EPUBBOOL=OFFThe user's documentation is generated in EPUB format.
LANG_ALLBOOL=OFFThe user's documentation is generated in English and in all available translations.
ESBOOL=OFFThe user's documentation is generated in English and in Spanish.
DOC_DEVBOOL=OFFThe English developer's documentation is generated in HTML format.

Table 1.1. Variables for the user's and the developer's documentation


Generate the user's and the developer's documentation in all formats and in all languages.

cmake -D DOC_ALL=ON -D LANG_ALL=ON -D DOC_DEV=ON ..
make doc
make doc_dev

Generate the user's documentation in HTML format and in all languages.

cmake -D DOC_HTML=ON -D LANG_ALL=ON ..
make doc

Generate the English user's documentation in all formats.

cmake -D DOC_ALL=ON ..
make doc

Generate the user's documentation in PDF format in English and in Spanish.

cmake -D DOC_PDF=ON -D ES=ON ..
make doc