跳转到主要内容

Postgis 源码编译安装

Postgis 源码编译安装

sudo yum install geos-devel proj-devel libxml protobuf-devel protobuf-c-devel mpfr-devel json-c

gdal-devel 源里没有,手动编译 gdal

https://github.com/OSGeo/gdal/releases/download/v3.7.1/gdal-3.7.1.tar.gz

mkdir build && cd build cmake .. make -j 4 sudo make intall

CGAL 5版本报错,使用 4版本之后正常

wget https://github.com/CGAL/cgal/releases/download/v5.5.2/CGAL-5.5.2.tar.xz wget https://github.com/CGAL/cgal/releases/download/releases%2FCGAL-4.14.3/CGAL-4.14.3.tar.xz

mkdir build && cd build cmake -DCMAKE_BUILD_TYPE=Release .. make -j 4 sudo make intall

SFCGAL https://oslandia.gitlab.io/SFCGAL/installation.html

不要使用系统自带的 boost, 自己编译 boost, https://www.boost.org/doc/libs/1_75_0/more/getting_started/unix-variants.html yum remove boost-devel boost wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz ./bootstrap.sh sudo ./b2 install

wget https://gitlab.com/Oslandia/SFCGAL/-/archive/v1.3.10/SFCGAL-v1.3.10.tar.gz mkdir build && cd build cmake .. make -j 4 sudo make intall

最后编译 postgis

wget https://download.osgeo.org/postgis/source/postgis-3.3.3.tar.gz

根据实际情况指定 PATH 和 LD_LIBRARY_PATH export PATH=/usr/local/pgsql/bin:$PATH export LD_LIBRARY_PATH=/usr/local/pgsql/lib:/usr/local/lib/:$LD_LIBRARY_PATH

./configure make -j sudo make install

测试 postgis 是否安装成功

create extension postgis; select postgis_full_version();