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:
- 下载:https://gmplib.org/
- 编译:./configure && make && make check && make install
mpfr:
- 下载:http://www.mpfr.org/
- 编译:./configure --with-gmp-include=/usr/local/include --with-gmp-lib=/usr/local/lib && make && make check && make install
mpc:
- 下载:http://www.multiprecision.org/index.php?prog=mpc
- 编译:./configure && make && make install
安装cgal
- 参考:CGAL 4.9 - Manual
- 下载:https://github.com/CGAL/cgal/releases
- 编译:cmake . && make && sudo make install
- 说明:默认头文件装在 usr/local/include/, 库文件装在 usr/local/lib/.
安装pgrouting
-
设置环境变量:
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