How to Install Open Source Routing Machine (OSRM) on Manjaro

In this tutorial, we will guide you on how to install Open Source Routing Machine (OSRM) on Manjaro. OSRM is a routing engine designed to support routing functions in map applications. It computes shortest paths between points on the earth's surface taking into consideration factors like one-way streets, turn restrictions, and elevation changes.

Prerequisites

Before starting the installation process, ensure that your Manjaro system meets the following requirements.

Step 1: Update Pacman package manager

First, update the Pacman package manager to ensure that you have the latest packages available.

sudo pacman -Syu

Step 2: Install dependencies

We need to install some OSRM dependencies including Git, CMake and Boost libraries.

sudo pacman -S git cmake boost

Step 3: Clone OSRM source

Clone the OSRM source repository from Github using Git.

git clone https://github.com/Project-OSRM/osrm-backend.git

Step 4: Build OSRM

Navigate to the directory where you cloned the OSRM source repository.

cd osrm-backend

Create a new directory called build.

mkdir build

Navigate to the build directory.

cd build

Configure and build OSRM.

cmake .. -DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install

Step 5: Download map data

Once you have successfully built OSRM, you need to download map data before you can generate routing directions. The map data is available in a compressed format in the PBF format. You can download the map data of your interest from the OpenStreetMap website.

For example, to download the map data for Germany, execute the following curl command:

curl http://download.geofabrik.de/europe/germany-latest.osm.pbf --create-dirs -o berlin-latest.osm.pbf

Step 6: Generate routing data

To generate routing data, execute the following command in the OSRM source directory.

osrm-extract berlin-latest.osm.pbf
osrm-contract berlin-latest.osrm

Step 7: Run the OSRM server

Finally, run OSRM server on your local machine using the following command.

osrm-routed berlin-latest.osrm

Conclusion

In this tutorial, we have shown you how to install Open Source Routing Machine (OSRM) on Manjaro. You can now generate routing directions on your local machine by running the OSRM server.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!