ja/1.x/InstallationCentOS5

CentOS 5.1 へのインストール

1.必要なパッケージのインストール

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

2. 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
./configure
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
./configure
sudo make install
  • ld.so.confファイルに /usr/local/libのパスを追加し、設定を反映させる。
sudo vi /etc/ld.so.conf
# add this line
/usr/local/lib
sudo /sbin/ldconfig

3. 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
./configure
sudo make install

4. PostgreSQLのセットアップ

pg_hba.confファイルのlocal部分について、ident sameuserとなっている箇所をtrustに変更し、postgresユーザがローカル・データベースへの接続を行えるようにしてください。また設定を反映させるために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. 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
./configure
gmake

6. pgRoutingのインストール

cd ..
svn checkout http://pgrouting.postlbs.org/svn/pgrouting/tags/release-1.02 pgrouting
cd pgrouting/
sudo [cmake_dir]/bin/cmake .
sudo make install

※[cmake_dir]はcmakeをインストールしたディレクトリで置き換えてください。

例)/home/hoge/cmake-2.4.8

7. 検索用データベースの作成

createdb -U postgres routing
createlang -U postgres plpgsql routing

# PostGIS機能を検索用データベースに追加
psql -U postgres -f /usr/share/lwpostgis.sql routing
psql -U postgres -f /usr/share/spatial_ref_sys.sql routing

# pgRouting機能を検索用データベースに追加
psql -U postgres -f /usr/share/postlbs/routing_core.sql routing
psql -U postgres -f /usr/share/postlbs/routing_core_wrappers.sql routing