= Installation on Ubuntu 8.04 (with PostgreSQL 8.3) with TSP and Driving Distance (Extras) =

To build pgRouting the following libraries are required:
 * pgRouting source code (http://pgrouting.postlbs.org)
 * C and C++ compilers
 * PostgreSQL version >= 8.0
 * PostGIS version >= 1.0
 * The Boost Graph Library (BGL). Version >= 1.33 which contains the astar.hpp (http://www.boost.org/libs/graph/doc/index.html)
 * For TSP (optional): The Genetic Algorithm Utility Library (GAUL) (http://gaul.sourceforge.net)
 * For Driving Distance (optional): Computational Geometry Algorithms Library (CGAL) version >= 3.2 (http://www.cgal.org) 

The workshop will use a virtual machine image running Xubuntu 8.04 with 
preinstalled pgRouting. You can download the virtual machine image from 
http://files.postlbs.org/foss4g2008/ 

For installation instructions on other platforms take a look at the pgRouting 
documentation pages: http://pgrouting.postlbs.org/wiki/pgRoutingDocs#Installation
pgRouting on the workshops virtual machine image has been installed like this:

== 1. Install required packages ==
{{{
sudo apt-get install build-essential subversion cmake
sudo apt-get install libboost-graph*
sudo apt-get install postgresql-8.3-postgis postgresql-server-dev-8.3
}}}

For Driving Distance algorithm (optional)
CGAL library can be easily installed using the Ubuntu multiverse repository.
{{{
sudo apt-get install libcgal*
}}}

For TSP algorithm (optional)
{{{
wget http://downloads.sourceforge.net/gaul/gaul-devel-0.1849-0.tar.gz?modtime=1114163427&big_mirror=0
tar -xzf gaul-devel-0.1849-0.tar.gz
cd gaul-devel-0.1849-0/
./configure --disable-slang
make
sudo make install
}}}

== 2. Compile pgRouting core (with TSP and DD flag on) ==
{{{
svn checkout http://pgrouting.postlbs.org/svn/pgrouting/trunk pgrouting

cd pgrouting/
cmake -DWITH_TSP=ON -DWITH_DD=ON .
make
sudo make install
}}}

== 3. 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.3/main/pg_hba.conf 
sudo /etc/init.d/postgresql-8.3 restart
}}}

== 4. Create routing database ==
To test your installation create a first routing database and load the routing
functions into this database.

{{{
createdb -U postgres routing
createlang -U postgres plpgsql routing
}}}

Add PostGIS functions
{{{
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
}}}

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 (optional)
{{{
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 (optional)
{{{
psql -U postgres -f /usr/share/postlbs/routing_dd.sql routing
psql -U postgres -f /usr/share/postlbs/routing_dd_wrappers.sql routing
}}}