一、编译环境准备
pgRouting的安装需要boost,cgal的编译环境,而cgal的安装又需要cmake编译工具。
1. 检查编译环境
在postgresql和postgis的安装中,我们已经安装了系统镜像的全部rpm包,boost也会被自动安装,可通过一下命令检查boost版本。
vim /usr/include/boost/version.hpp
- cgal
https://github.com/CGAL/cgal/releases/tag/releases%2FCGAL-4.13.2
- cmake
https://cmake.org/files/v3.2/cmake-3.2.0.tar.gz
- pgrouting
https://github.com/pgRouting/pgrouting/releases/download/v2.6.3/pgrouting-2.6.3.tar.gz
二、编译安装上述依赖
1. 卸载旧版本cmake
如果服务器版本足够,可忽略此步骤
可以通过命令cmake -version检查服务器自带版本。如果偏低,需要卸载后重新安装新版本。
需要3.1以上版本
yum remove cmake -y
2. cmake
cmake
tar -zxvf cmake-3.2.0.tar.gz
cd cmake-3.2.0
./bootstrap
gmake
gmake install
新建软连接
将安装路径连接到编译时查找的路径
ln -s /usr/local/bin/cmake /usr/bin/
3. cgal
tar -zxvf CGAL-4.13.2.tar.gz
cd cgal-releases-CGAL-4.13.2
mkdir build
cd build
cmake ..
make
make install
三、安装pgrouting
tar -zxvf pgrouting-2.6.3.tar.gz
cd pgrouting-2.6.3
mkdir build
cd build
cmake ..
make
make install
四、配置pgrouting安装路径
cp /usr/local/lib64/libCGAL.so.13 /home/work/postgresql/lib
编辑配置文件vim /etc/ld.so.conf,增加pgrouting安装的路径后,执行ldconfig,使配置生效
五、测试
进入数据库客户端,增加空间扩展,具体参考我上篇postgis安装博客
来源:CSDN
作者:ceshell
链接:https://blog.csdn.net/ceshell/article/details/103795556