3. Installation and Requirements

For this workshop you need:

  • A webserver like Apache with PHP support (and PHP PostgreSQL module)
  • Preferrable a Linux operating system like Ubuntu
  • An editor like Gedit
  • Internet connection

All required tools are available on the OSGeo LiveDVD, so the following reference is a quick summary of how to install it on your own computer running latest Ubuntu 10.04.

3.1. Software

Installation of pgRouting on Ubuntu became very easy now because packages are available in a Launchpad repository:

All you need to do now is to open a terminal window and run:

# Add pgRouting launchpad repository
sudo add-apt-repository ppa:georepublic/pgrouting
sudo apt-get update

# Install pgRouting packages
sudo apt-get install gaul-devel \
        postgresql-8.4-pgrouting \
        postgresql-8.4-pgrouting-dd \

# Install osm2pgrouting package
sudo apt-get install osm2pgrouting

# Install workshop material (optional)
sudo apt-get install pgrouting-workshop

This will also install all required packages such as PostgreSQL and PostGIS if not installed yet.


  • “Multiverse” packages must be available as software sources. Currently only packages for Ubuntu 10.04 have been built, but further packages are likely to come if there is demand for them.
  • To be up-to-date with changes and improvements you might run sudo apt-get update & sudo apt-get upgrade from time to time, especially if you use an older version of the LiveDVD.
  • To avoid permission denied errors for local users you can set connection method to trust in /etc/postgresql/8.4/main/pg_hba.conf and restart PostgreSQL server with sudo service postgresql-8.4 restart.

3.2. Data

The pgRouting workshop will make use of OpenStreetMap data of Barcelona, which is already available on the LiveDVD. If you don’t use the LiveDVD or want to download the latest data or the data of your choice, you can make use of OpenStreetMap’s API from your terminal window:

# Dowload as file barcelona.osm
wget --progress=dot:mega -O barcelona.osm \
        http://osmxapi.hypercube.telascience.org/api/0.6/map \

The API has a download size limitation, which can make it a bit inconvenient to download large areas with many features. An alternative is JOSM Editor, which also makes API calls to dowload data, but it provides an user friendly interface. You can save the data as .osm file to use it in this workship. JOSM is also available on the LiveDVD.


An alternative for very large areas is the download service of CloudMade. The company offers extracts of maps from countries around the world. For data of Spain for example go to http://download.cloudmade.com/europe/spain and download the compressed .osm.bz2 file:

wget --progress=dot:mega http://download.cloudmade.com/europe/spain/spain.osm.bz2


Data of a whole country might be too big for the LiveDVD as well as processing time might take very long.

3.3. Workshop

If you installed the workshop package you will find all documents in /usr/share/pgrouting/workshop/.

We recommend to copy the files to your home directory and make a symbolic link to your webserver’s root folder:

cp -R /usr/share/pgrouting/workshop ~/Desktop/pgrouting-workshop
sudo ln -s ~/Desktop/pgrouting-workshop /var/www/pgrouting-workshop

You can then find all workshop files in the pgrouting-workshop folder and access to


Additional sample data is available in the workshop data directory. It contains a compressed file with database dumps as well as a smaller network data of Barcelona downtown. To extract the file run tar -xzf ~/Desktop/pgrouting-workshop/data.tar.gz.

Table Of Contents

Previous topic

2. About

Next topic

4. osm2pgrouting Import Tool


This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.

Creative Commons License