文章目录
- OpenEulr 23.03 x86_64
- 依赖
- 安装
 
- centos7.6 x86_64
- 依赖
- 安装
 
给postgres 12安装postgis。
postgres 12支持的postgis版本为:(检查postgis POSTGIS_PGSQL_VERSION)
postgis>=2.5
OpenEulr 23.03 x86_64
依赖
postgis-3.4.2依赖:(yum源安装的版本及postgis版本要要求)
proj:8.2.1-1.oe2303  (>=6.1)
geos:3.9.0-1.oe2303  (>=3.6)
libxml2:2.9.14-7.oe2303 (>=2.5.0)
gettext:0.21.1-1.oe2303 (>=0.14)
json-c:0.16-2.oe2303    (>=0.9)
cmake: 3.24.3-1.oe2303 
以下可选安装:
gdal:3.2.3 编译安装 (proj>=6)
CGAL:5.3.2 (>=5.3   gmp-devel  mpfr-devel boost-devel)
SFCGAL: 1.4.1+  编译安装 (cmake CGAL>=5.3)
protobuf-c: (>=1.1.0)
GTK:GUI相关不用装(>==2.2.0)
安装
用yum安装相关依赖
yum install cmake sqlite sqlite-devel proj proj-devel geos geos-devel libxml2 libxml2-devel gettext json-c json-c-devel protobuf-c protobuf-c-devel  gmp-devel mpfr-devel boost-devel pcre2-devel
下载gdal-3.2.3 SFCGAL-v1.4.1 cgal-5.3.2
 编译安装gdal-3.2.3:
./configure
make 
make install
编译安装SFCGAL-v1.4.1
export CMAKE_PREFIX_PATH=/opt/cgal-5.3.2
cmake .
make
make install
加入SFCGAL的库
 修改/etc/ld.so.conf,加入:
 /usr/local/lib64/
 执行ldconfig
 编译安装postgis-3.4.2:
./configure --prefix=/opt/postgis-3.4.2 --with-pgconfig=/opt/pgsql/bin/pg_config
make
make install
configure后显示:
  GEOS config:          /usr/bin/geos-configGEOS version:         3.9.0GDAL config:          /usr/bin/gdal-configGDAL version:         3.2.3SFCGAL config:        /usr/local/bin/sfcgal-configSFCGAL version:       1.4.1PostgreSQL config:    /opt/pgsql/bin/pg_configPostgreSQL version:   PostgreSQL 12.14PROJ4 version:        82Libxml2 config:       /usr/bin/xml2-configLibxml2 version:      2.9.14JSON-C support:       yesprotobuf support:     yesprotobuf-c version:   1004001PCRE support:         Version 2Perl:                 /usr/bin/perl--------------- Extensions ---------------PostgreSQL EXTENSION support:       enabledPostGIS Raster:                     enabledPostGIS Topology:                   enabledSFCGAL support:                     enabledAddress Standardizer support:       enabled
centos7.6 x86_64
依赖
postgis-2.5依赖: (yum源安装的版本及postgis版本要要求)
proj: 4.8.0  (>=4.9)                # 不满足,需要自己安装
geos: 3.4.2  (3.5-3.8  3.8 recommanded)  # 不满足,需要自己安装
libxml2: 2.9.1 (>=2.5.0)
gettext: 0.19.8.1 (>=0.14)
json-c: 0.11    (>=0.9)
cmake: 2.8.12.2 
以下可选安装:
gdal: 2.4.4 编译安装(>=1.9 proj>=4)
CGAL:4.7 (>=4.1   gmp-devel  mpfr-devel boost-devel)
SFCGAL: 1.2.2  编译安装 (cmake CGAL 4.3 or 4.7 gcc>=4.5)
protobuf-c: 1.0.2-3  (>=1.1.0)  # 不满足,要么不用要么自己装新版本
GTK:GUI相关不用装(>==2.2.0)
安装
用yum安装相关依赖
yum install cmake   libxml2 libxml2-devel gettext json-c json-c-devel   gmp-devel mpfr-devel boost-devel pcre2-devel
编译安装proj-4.9
./configure
make
make install
编译安装geo3.8:
sh autogen.sh
./configure
make
make install
编译安装gdal-2.4.4:
./configure --prefix=/opt/gdal-2.4.4
make
make install
编译安装CGAL:4.7
cmake -DCMAKE_INSTALL_PREFIX=/opt/cgal-CGAL-4.7 .
make 
make install
编译安装SFCGAL: 1.2.2:
修改 /opt/cgal-CGAL-4.7/include/CGAL/version.h CGAL_VERSION_NR改为 >1040701000
cmake -DCGAL_DIR=/opt/cgal-CGAL-4.7  -DCGAL_LIBRARY_DIRS=/opt/cgal-CGAL-4.7/lib . 
make
make install
编译安装protobuf-c-1.1.1
./configure
make
make install
修改/etc/ld.so.conf,增加:
/usr/local/lib64/
/usr/local/lib/
/opt/cgal-releases-CGAL-4.7/lib64/
/opt/gdal-2.4.4/lib/
编译安装postgis-2.5:
sh autogen.sh
./configure  --with-pgconfig=/usr/local/pgsql/bin/pg_config --with-gdalconfig=/opt/gdal-2.4.4/bin/gdal-config --with-sfcgal=/opt/cgal-releases-CGAL-4.7/bin/sfcgal-config --with-protobufdir=/opt/protobuf-c-1.1.1
make
make install
configure后显示:
 -------------- Dependencies --------------GEOS config:          /usr/local/bin/geos-configGEOS version:         3.8.4GDAL config:          /opt/gdal-2.4.4/bin/gdal-configGDAL version:         2.4.4SFCGAL config:        /opt/cgal-releases-CGAL-4.7/bin/sfcgal-configSFCGAL version:       1.2.2PostgreSQL config:    /usr/local/pgsql/bin/pg_configPostgreSQL version:   PostgreSQL 12.4PROJ4 version:        49Libxml2 config:       /usr/bin/xml2-configLibxml2 version:      2.9.1JSON-C support:       yesprotobuf-c support:   yesprotobuf-c version:   1001001PCRE support:         yesPerl:                 /usr/bin/perl--------------- Extensions ---------------PostgreSQL EXTENSION support:       enabledPostGIS Raster:                     enabledPostGIS Topology:                   enabledSFCGAL support:                     enabledAddress Standardizer support:       enabled