Skip to content

Instantly share code, notes, and snippets.

@samuelleach
Forked from iandees/install.md
Created May 20, 2017 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samuelleach/49ce0566922cfd9e2c8ec58bc5cecc3c to your computer and use it in GitHub Desktop.
Save samuelleach/49ce0566922cfd9e2c8ec58bc5cecc3c to your computer and use it in GitHub Desktop.
Installing and running Project OSRM, the OpenStreetMap-based routing engine, on an Amazon EC2 instance.

My goal here was the create a routable graph for Chicago.

I used Ubuntu 12.04LTS on an m2.4xlarge just to be sure memory wasn't too much of an issue.

Install

Start a screen session and start downloading an OSM extract (I used this extract of Illinois). In another screen I did the following:

  sudo apt-get update && sudo apt-get upgrade -y
  sudo apt-get -y install git make cmake build-essential \
                  libbz2-dev \
                  zlib1g-dev \
                  libxml2-dev \
                  liblua5.1-dev \
                  libboost-filesystem-dev \
                  libboost-iostreams-dev \
                  libboost-program-options-dev \
                  libboost-regex-dev \
                  libboost-system-dev \
                  libboost-thread-dev \
                  libprotobuf-dev \
                  libstxxl-dev \
                  libosmpbf-dev
  git clone https://github.com/DennisOSRM/Project-OSRM.git
  cd Project-OSRM
 
  # From the [OSRM wiki](https://github.com/DennisOSRM/Project-OSRM/wiki/Building%20OSRM)
  mkdir -p build
  cd build
  cmake ..
  make

Running

Build the graph

  # From [OSRM wiki](https://github.com/DennisOSRM/Project-OSRM/wiki/Running-OSRM)
  ln -s ../profiles/car.lua profile.lua
  ln -s ../profiles/lib/
  ./osrm-extract /mnt/tmp/illinois-latest.osm.pbf
  # ...wait ~3 minutes
  ./osrm-prepare /mnt/tmp/illinois-latest.osrm
  # ...wait ~10 minutes

Run the router

  ./osrm-routed --hsgrdata /mnt/tmp/illinois-latest.osrm.hsgr \
                --nodesdata /mnt/tmp/illinois-latest.osrm.nodes \
                --edgesdata /mnt/tmp/illinois-latest.osrm.edges \
                --ramindex /mnt/tmp/illinois-latest.osrm.ramIndex \
                --fileindex /mnt/tmp/illinois-latest.osrm.fileIndex \
                --namesdata /mnt/tmp/illinois-latest.osrm.names

Set up the website

  # Install Apache
  sudo apt-get install -y apache2
  # From [OSRM-web github](https://github.com/DennisSchiefer/Project-OSRM-Web)
  cd
  git clone https://github.com/DennisSchiefer/Project-OSRM-Web
  chmod 755 -R Project-OSRM-Web
  sudo ln -s /home/ubuntu/Project-OSRM-Web/WebContent /var/www/osrm
  
  # Edit the config file to point at your instance
  vi /home/ubuntu/Project-OSRM-Web/WebContent/OSRM.config.js
  # Change `url` and `timestamp` params at lines 23 and 24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment