(1)安装gdal
# wget http://download.osgeo.org/gdal/2.0.0/gdal-2.0.0.tar.gz
# tar zxvf gdal-2.0.0.tar.gz
# cd gdal-2.0.0
# ./configure --prefix=/usr/local/gdal --with-xml2=/usr/bin/xml2-config --with-static-proj4=/usr/bin/proj
# make
# make install
(2)安装geos
# wget http://download.osgeo.org/geos/geos-3.5.0.tar.bz2
# tar jxvf geos-3.5.0.tar.bz2
# cd geos-3.5.0
# ./configure --prefix=/usr/local/geos3
# make
# make install
(3)安装geos
# tar jxvf geos-3.5.0.tar.bz2
# cd geos-3.5.0
# ./configure --prefix=/usr/local/geos3
# make
# make install
配置依赖库的路径信息
# vi /etc/ld.so.conf
/usr/local/pgsql9_4_8/lib(根据自己安装的路径改动)
/usr/local/gdal/lib (根据自己安装的路径改动)
/usr/local/geos3/lib (根据自己安装的路径改动)
/usr/local/lib
#ldconfig
(4)postgis安装
1、posgis安装
# wget http://download.osgeo.org/postgis/source/postgis-2.2.2.tar.g
# tar zxvf postgis-2.2.2.tar.gz
# cd postgis-2.2.2.tar.gz
# ./configure --with-pgconfig=/usr/local/pgsql9_4_8/bin/pg_config --with-gdalconfig=/usr/local/gdal/bin/gdal-config --with-geosconfig=/usr/local/geos3/bin/geos-config
# make
2、extensions安装
# cd extensions
# cd postgis
# make clean
# make
# make install
3、postgis_topology安装
# cd postgis_topology
# make clean
# make
# make install
4、postgis_tiger_geocoder安装
# cd postgis_tiger_geocoder
# make clean
# make
# make install
5、添加拓展
# su - postgres
进入控制台执行以下语句:
CREATE EXTENSION postgis;
CREATE EXTENSION fuzzystrmatch;
CREATE EXTENSION postgis_tiger_geocoder;
CREATE EXTENSION postgis_topology;
CREATE EXTENSION pgrouting;
(5)pgrouting安装
1、CGAL-4.8.1.tar.xz 安装
# tar Jxvf CGAL-4.8.1.tar.xz
# cd CGAL-4.8.1
# yum install gmp gmp-devel
# yum install mpfr mpfr-devel
# cmake .
# make
# make install
2、pgrouting 安装
#cd ..
# tar zxvf pgrouting-2.2.0.tar.gz
# cd pgrouting-pgrouting-2.2.0/
# mkdir build
# cd build/
# cmake3 ..
# make
# make install