OSRM source is available via git or source archives, and is built with CMake.
To download from Git, run the following commands:
git clone https://github.com/Project-OSRM/osrm-backend.git -b 5.5
cd osrm-backend
If you would like to build a specific release (optional), you can list the release tags with git tag -l
and then checkout a specific tag using git checkout tags/<tag_name>
.
OSRM can be built from the source archives available on the releases page. Example:
wget https://github.com/Project-OSRM/osrm-backend/archive/vX.Y.Z.tar.gz
tar -xzf vX.Y.Z.tar.gz
cd osrm-backend-X.Y.Z
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
sudo cmake --build . --target install
cp -R ../profiles ./
ln -s profiles/car.lua profile.lua (Create symbolink for car.lua as profile.lua)
wget https://s3-ap-southeast-1.amazonaws.com/sla-onemap2/osrm-backend-drive-preinstalled.zip
sudo apt-get install zip unzip
unzip osrm-backend-drive-preinstalled.zip
mv osrm-backend-drive-preinstalled osrm-backend-drive
See below for required dependencies.
mkdir -p build (ignore if existed)
cp -R profiles build/
cd build
nano profile.lua
Edit profile.lua (line 3) to include "profiles" in front of "lib/access".
From: local find_access_tag = require("lib/access").find_access_tag
To: local find_access_tag = require("profiles/lib/access").find_access_tag
Save the file.
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
sudo cmake --build . --target install
./osrm-extract [filename].osm
./osrm-contract [filename].osrm
./osrm-routed [filename].osrm
nano run.sh
Copy & Paste (Ensure that you have input the proper filename for your OSRM file:
#!/bin/bash
./osrm-routed [filename].osrm
Save the file.
Using PM2 as Process Manager. We support NodeJS 4.x
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
node -v
npm -v
sudo npm install -g pm2
sudo pm2 startup ubuntu
Ensure you are in your OSRM directory such as /home/ubuntu/osrm-backend/build with your bash script (run.sh) in it.
sudo pm2 start run.sh --name "OSRM"
sudo pm2 save