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.
Before starting the installation, make sure you have the following prerequisites:
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-dev
Download the latest OSRM source code from the project repository by running the following command:
git clone https://github.com/Project-OSRM/osrm-backend.git
Navigate to the downloaded directory:
cd osrm-backend
Create a 'build' directory and navigate into it:
mkdir build && cd build
Run 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
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.pbf
Prepare the map data for routing by running the following command:
osrm-contract <your_map_data>.osrm
Start the server by running the following command:
osrm-routed <your_map_data>.osrm
The server will start running, and you should see a similar output in your terminal:
[info] listening on: http://127.0.0.1:5000
Open 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.
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!
Alternatively, for the best virtual desktop, try Shells!