linux下安装pgrouting - cytggit/Map-openlayers GitHub Wiki

linux下安装pgrouting 方法1

安装Boost

  • 下载:http://www.boost.org/
  • 解压:到/opt/下
  • 解决依赖关系: yum install python gccxml gcc gcc-c++ (如果还不全,就用apt-cache depends XXXXXXX查去)
  • 编译bjam:cd /opt/boost_1_47_0 && sudo ./bootstrap.sh && ./b2 && ./b2 install
  • update动态链接库: sudo ldconfig

安装m4、GMP、mfpr

m4

  • 下载&安装:yum install m4

gmp:

mpfr:

  • 下载:http://www.mpfr.org/
  • 编译:./configure --with-gmp-include=/usr/local/include --with-gmp-lib=/usr/local/lib && make && make check && make install

mpc:

安装cgal

安装pgrouting

  • 下载:https://github.com/pgRouting/pgrouting/releases

  • 设置环境变量:

      export LD_LIBRARY_PATH=/opt/pgsql/9.6.1/lib:/usr/local/lib:/usr/local/lib64
    
      export PATH=/opt/pgsql/9.6.1/bin:$PATH
    
      export MANPATH=/opt/pgsql/9.6.1/share/man:$MANPATH
    
  • 编译:mkdir build && cd build && cmake .. && make && sudo make install

  • 生成的libpgrouting-2.3.so放入/usr/pgsql-9.6/lib/,sql放入/usr/pgsql-9.6/share/extension

linux下安装pgrouting 方法2

安装方法1的依赖库

直接安装

  • yum install pgrouting96
  • su postgres
  • psql -d testdb -U postgres -W -f /usr/pgsql-9.6/share/contrib/pgrouting-2.0/pgrouting.sql