How to install OSRM backend on Ubuntu Ubuntu 20.04.1 LTS
Originally posted on https://whyboobo.com/devops/install-osrm-ubuntu/
What is OSRM?
The Open Source Routing Machine or OSRM is a C++ implementation of a high-performance routing engine for shortest paths in road networks. Licensed under the permissive 2-clause BSD license, OSRM is a free network service. OSRM supports Linux, FreeBSD, Windows, and Mac OS X platform.
Tutorial used from Digital Ocean using Geofabrik Map.
Before digging into, you can check Initial Server Setup with Ubuntu 14.04. I added 4GB swap memory using this tutorial.
Please note that the structure for your folders should be
- ROOT
- osrm
- map.osm.pbf
- osrm-backend (this is the repo cloned. info how to build also here)
See below for required dependencies. Official Documentation here.
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
sudo cmake --build . --target install
To extract the maps you should be in the root.
~$ osrm-extract osrm/map-latest.osm.pbf -p ./osrm-backend/profiles/car.lua
How to run osrm locally:
osrm-routed /home/osrm/osrm/map.osrm