Table Of Contents

Previous topic

Installation on Ubuntu

Next topic

Installation on FreeBSD

Make a Donation

Support pgRouting with some donation! Read more about how your donation will help the project.


Installation on CentOS


Only valid for pgRouting v1.x. For pgRouting v2.0 or higher see


This install manual was written for CentOS 5.1

Install required packages

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

Compile proj4 & geos

  • proj4
tar -zxvf proj-4.6.0.tar.gz
cd proj-4.6.0
sudo make install
  • geos
cd ..
tar -jxvf geos-3.0.0.tar.bz2
cd geos-3.0.0
sudo make install
  • Add lib path to file
sudo vi /etc/
# add this line
sudo /sbin/ldconfig

Compile PostGIS

cd ..
tar -zxvf postgis-1.3.3.tar.gz
cd postgis-1.3.3
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 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

Compile cmake

cd ..
tar -zxvf cmake-2.4.8.tar.gz
cd cmake-2.4.8

Compile pgRouting

git clone git:// 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

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