Skip to content

Installation and Setup

Felix Gündling edited this page Jan 17, 2023 · 13 revisions

This sets up the release version of MOTIS. For a developer setup see the other piki pages

There are different options to start MOTIS:

  • Docker (on any system that supports Docker)
  • Linux binary
  • Windows binary
  • Mac OS X binary

Best practice is to setup MOTIS with two separate folders (aka "volumes" for Docker):

  • data folder/volume (MOTIS needs read+write access), this folder will contain preprocessed data, logs and temporary files
  • input folder/volume (MOTIS needs read-only access), this folder will contain input data such as OpenStreetMap data, timetables, coastline data, SRTM data, etc.

For each target platfrom (Docker, Linux, Windows, Mac OS), the first step is to create an input folder with the data you want to use for your server. This is typically

  • an OpenStreetMap file in the *.osm.pbf format (region extracts can be downloaded from Geofabrik.
  • one or more timetables (ZIP files need to be extracted). Supported timetable formats are at the moment GTFS and HAFAS Rohdaten.
  • and a config.ini pointing MOTIS to the data in the input folder as well as configuring MOTIS

You can save one of the following scripts as setup.sh and run it with sh setup.sh (or chmod +x setup.sh && ./setup.sh). Note: the following scripts delete files from previous runs (see first section). So make sure you run this script in a fresh folder.

Unix Setup - Mac OS X and Linux (executable)

The following script demonstrates a simple intermodal routing setup with MOTIS on Linux using the MOTIS executable. Make sure you have basic utilities like wget and unzip installed.

For Mac OS X: change the MOTIS distribution download URL in the script to one that fits your system:

  • Apple Silicon (M1, M2, etc.): https://github.com/motis-project/motis/releases/download/v0.8.7/motis-macos-arm64.tar.bz2
  • Intel CPU: https://github.com/motis-project/motis/releases/download/v0.8.7/motis-macos-x86_64.tar.bz2
#!/bin/sh

# Clear data from previous runs.
chmod -R +w input
rm -rf motis
rm -rf test-data-aachen
rm -rf input
rm -rf motis-linux-amd64.tar.bz2
rm -rf aachen.zip
rm -rf data

# Download and extract MOTIS.
# Note: this is for AVX2-enabled x86-64 systems.
#       change the URL according to your
#       system's architecture and operating system.
wget https://github.com/motis-project/motis/releases/latest/download/motis-linux-amd64.tar.bz2
tar xf motis-linux-amd64.tar.bz2

# Download a small test dataset from Aachen, Germany
# This includes the timetable + OSM region extract for the core-city only.
wget https://github.com/motis-project/test-data/archive/refs/heads/aachen.zip
unzip -o aachen.zip

# Create input folder.
mkdir -p input/schedule
unzip test-data-aachen/AVV_HAFAS_520.zip -d input/schedule
mv test-data-aachen/zeitvs input/schedule
mv test-data-aachen/aachen.osm.pbf input/osm.pbf

# Write config.ini
echo "\
modules=intermodal\n\
modules=routing\n\
modules=railviz\n\
modules=path\n\
modules=lookup\n\
modules=address\n\
modules=guesser\n\
modules=tiles\n\
modules=osrm\n\
modules=ppr\n\
modules=parking\n\
\n\
server.static_path=motis/web\n\
dataset.begin=20210809\n\
\n\
[import]\n\
paths=schedule:input/schedule\n\
paths=osm:input/osm.pbf\n\
\n\
[osrm]\n\
profiles=motis/osrm-profiles/car.lua\n\
profiles=motis/osrm-profiles/bike.lua\n\
profiles=motis/osrm-profiles/bus.lua\n\
\n\
[ppr]\n\
profile=motis/ppr-profiles/default.json\n\
\n\
[tiles]\n\
profile=motis/tiles-profiles/background.lua\n\
\n" > input/config.ini

# Set permissions
# - some timetables come without read access
# - MOTIS should not need write access
chmod -R +r input
chmod -R -w input

# Start MOTIS
./motis/motis -c input/config.ini

Docker Setup

The following script demonstrates a simple intermodal routing setup with MOTIS on Linux using the MOTIS executable. Make sure you have basic utilities like wget and unzip as well as an up-to-date version of Docker with the Docker compose plugin installed.

#!/bin/sh

# Clear data from previous runs.
chmod -R +w input
rm -rf motis
rm -rf test-data-aachen
rm -rf input
rm -rf aachen.zip
rm -rf data
rm -f docker-compose.yml

# Download a small test dataset from Aachen, Germany
# This includes the timetable + OSM region extract for the core-city only.
wget https://github.com/motis-project/test-data/archive/refs/heads/aachen.zip
unzip -o aachen.zip

# Create input folder.
mkdir -p input/schedule
unzip test-data-aachen/AVV_HAFAS_520.zip -d input/schedule
mv test-data-aachen/zeitvs input/schedule
mv test-data-aachen/aachen.osm.pbf input/osm.pbf

# Write config.ini
echo "\
modules=intermodal\n\
modules=routing\n\
modules=railviz\n\
modules=path\n\
modules=lookup\n\
modules=address\n\
modules=guesser\n\
modules=tiles\n\
modules=osrm\n\
modules=ppr\n\
modules=parking\n\
\n\
dataset.begin=20210809\n" > input/config.ini

# Set permissions
# - some timetables come without read access
# - MOTIS should not need write access
chmod -R +r input
chmod -R -w input

# Write Docker Compose file.
echo "\
version: "3.9"\n\
services:\n\
  motis-aachen:\n\
    image: ghcr.io/motis-project/motis:v0.8\n\
    ports:\n\
      - "8080:8080"\n\
    volumes:\n\
      - type: bind\n\
        source: ./input\n\
        target: /input\n\
        read_only: true\n\
      - type: volume\n\
        source: data-volume\n\
        target: /data\n\
    restart: always\n\
volumes:\n\
 data-volume:\n" > docker-compose.yml

# Run.
docker compose up

Windows Setup

TODO

Clone this wiki locally