Table of Contents
PG routing installation
This howto is based on the official page of PGRouting that describes the installation on Ubuntu with the previous version ( http://www.pgrouting.org/docs/1.x/install_ubuntu.html)
Environment:
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 10.04.3 LTS Release: 10.04 Codename: lucid
Install Required Packages
sudo apt-get install build-essential git-core cmake sudo apt-get install postgresql postgresql-8.4-postgis postgresql-server-dev-8.4
If you’re not planning to install CGAL from Ubuntu multiverse, you can use default Boost library from the repository. This will be version 1.34 at the moment.
sudo apt-get install libboost-graph-dev
For Driving Distance
sudo apt-get install libcgal*
Note: if you install CGAL later from Ubuntu multiverse it will upgrade to Boost 1.35. This might cause troubles if you compiled pgRouting core already with Boost 1.34.
For TSP
wget http://downloads.sourceforge.net/gaul/gaul-devel-0.1850-0.tar.gz tar -xzf gaul-devel-0.1850-0.tar.gz cd gaul-devel-0.1850-0/ ./configure --disable-slang make sudo make install sudo ldconfig
Compile pgRouting core (with TSP and DD flag on)
git clone git://github.com/pgRouting/pgrouting.git pgrouting cd pgrouting/ cmake -DWITH_TSP=ON -DWITH_DD=ON . make sudo make install
Setup PostgreSQL
Set local database connections to “trust” in “pg_hba.conf” to be able to work with PostgreSQL as user “postgres”. Then restart PostgreSQL.
sudo gedit /etc/postgresql/8.4/main/pg_hba.conf sudo /etc/init.d/postgresql-8.4 restart # TYPE DATABASE USER CIDR-ADDRESS METHOD local all all trust
Start postgresql daemon
sudo /etc/init.d/postgresql-8.4 start
Create routing database
createdb -U postgres routing createlang -U postgres plpgsql routing
Add PostGIS functions
8.3:
psql -U postgres -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql routing psql -U postgres -f /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql routing
8.4:
psql -U postgres -f /usr/share/postgresql/8.4/contrib/postgis.sql routing psql -U postgres -f /usr/share/postgresql/8.4/contrib/spatial_ref_sys.sql routing
Add pgRouting functions
psql -U postgres -f /usr/share/postlbs/routing_core.sql routing psql -U postgres -f /usr/share/postlbs/routing_core_wrappers.sql routing psql -U postgres -f /usr/share/postlbs/routing_topology.sql routing
Add TSP functions
psql -U postgres -f /usr/share/postlbs/routing_tsp.sql routing psql -U postgres -f /usr/share/postlbs/routing_tsp_wrappers.sql routing
Add Driving Distance functions
psql -U postgres -f /usr/share/postlbs/routing_dd.sql routing psql -U postgres -f /usr/share/postlbs/routing_dd_wrappers.sql routing