How to install Open Source Routing Machine (OSRM) on Debian Latest
This tutorial will guide you through the process of installing Open Source Routing Machine (OSRM) on Debian Latest. OSRM is an open-source solution for route planning and navigation, which provides fast route calculations and optimizations for car, bike and foot transportation modes.
Prerequisites
Before starting the installation, make sure you have the following prerequisites:
- Debian Latest installed on your system
- Sudo user privileges
Step 1: Download and Install OSRM
Open your terminal and run the following command to download and install the dependencies:
sudo apt-get update && sudo apt-get install build-essential cmake pkg-config libbz2-dev libxml2-dev libzip-dev libboost-all-dev liblua5.2-dev libtbb-devDownload the latest OSRM source code from the project repository by running the following command:
git clone https://github.com/Project-OSRM/osrm-backend.gitNavigate to the downloaded directory:
cd osrm-backendCreate a 'build' directory and navigate into it:
mkdir build && cd buildRun the following command to generate a makefile:
cmake ..Build the application by running the following command:
cmake --build .Install the application by running the following command:
sudo cmake --build . --target install
Step 2: Download and Prepare the Map Data
Download the map data for your region of interest from OpenStreetMap.org, for example, by using the "Export" function. Save the data file in the 'osrm-backend' directory.
Extract the map data by running the following command:
osrm-extract <your_map_data>.osm.pbfPrepare the map data for routing by running the following command:
osrm-contract <your_map_data>.osrm
Step 3: Run OSRM Server
Start the server by running the following command:
osrm-routed <your_map_data>.osrmThe server will start running, and you should see a similar output in your terminal:
[info] listening on: http://127.0.0.1:5000Open your web browser and navigate to the following URL to access OSRM:
http://127.0.0.1:5000/{service}?{parameters}Replace
{service}with the desired routing service, e.g.,route,nearest,table.Replace
{parameters}with the required parameters for the service, e.g.,loc={latitude},{longitude}.You can also use
http://{server-ip}:{port}/{service}?{parameters}to access the server from another machine on the same network.Example: http://127.0.0.1:5000/route/v1/driving/-122.42,37.78;-122.45,37.79?steps=true
Congratulations! You have successfully installed and set up Open Source Routing Machine (OSRM) on Debian Latest.