Installation on CentOS 5.1

1.Install required packages

sudo yum install subversion boost-devel gcc-c++
sudo yum install postgresql-server postgresql-devel flex

2. Compile proj & geos

  • proj
wget ftp://ftp.remotesensing.org/proj/proj-4.6.0.tar.gz
tar -zxvf proj-4.6.0.tar.gz
cd proj-4.6.0
sudo make install
  • geos
cd ..
wget http://geos.refractions.net/downloads/geos-3.0.0.tar.bz2
tar -jxvf geos-3.0.0.tar.bz2
cd geos-3.0.0
sudo make install
  • Add lib path to ld.so.conf file
sudo vi /etc/ld.so.conf
# add this line
sudo /sbin/ldconfig

3. Compile PostGIS

cd ..
Wget http://www.postgis.org/download/postgis-1.3.3.tar.gz
tar -zxvf postgis-1.3.3.tar.gz
cd postgis-1.3.3
sudo make install

4. 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 vi /var/lib/pgsql/data/pg_hba.conf
# "local" is for Unix domain socket connections only
#local   all         all                               ident sameuser
local   all     all                                     trust
sudo /etc/init.d/postgresql restart

5. Compile cmake

cd ..
wget http://www.cmake.org/files/v2.4/cmake-2.4.8.tar.gz
tar -zxvf cmake-2.4.8.tar.gz
cd cmake-2.4.8

6. Compile pgRouting

cd ..
svn checkout http://pgrouting.postlbs.org/svn/pgrouting/trunk pgrouting
cd pgrouting/
sudo [cmake_dir]/bin/cmake .
sudo make install

* please replace [cmake_dir] with the path which cmake is installed ex)/home/hoge/cmake-2.4.8

7. Create routing database

createdb -U postgres routing
createlang -U postgres plpgsql routing

# Add PostGIS functions
psql -U postgres -f /usr/share/lwpostgis.sql routing
psql -U postgres -f /usr/share/spatial_ref_sys.sql routing

# Add core 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