当前位置:   article > 正文

postgres12安装postgis_postgresql安装postgis

postgresql安装postgis


给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)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

安装

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
  • 1

下载gdal-3.2.3 SFCGAL-v1.4.1 cgal-5.3.2
编译安装gdal-3.2.3:

./configure
make 
make install
  • 1
  • 2
  • 3

编译安装SFCGAL-v1.4.1

export CMAKE_PREFIX_PATH=/opt/cgal-5.3.2
cmake .
make
make install
  • 1
  • 2
  • 3
  • 4

加入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
  • 1
  • 2
  • 3

configure后显示:

  GEOS config:          /usr/bin/geos-config
  GEOS version:         3.9.0
  GDAL config:          /usr/bin/gdal-config
  GDAL version:         3.2.3
  SFCGAL config:        /usr/local/bin/sfcgal-config
  SFCGAL version:       1.4.1
  PostgreSQL config:    /opt/pgsql/bin/pg_config
  PostgreSQL version:   PostgreSQL 12.14
  PROJ4 version:        82
  Libxml2 config:       /usr/bin/xml2-config
  Libxml2 version:      2.9.14
  JSON-C support:       yes
  protobuf support:     yes
  protobuf-c version:   1004001
  PCRE support:         Version 2
  Perl:                 /usr/bin/perl
  
   --------------- Extensions ---------------
  PostgreSQL EXTENSION support:       enabled
  PostGIS Raster:                     enabled
  PostGIS Topology:                   enabled
  SFCGAL support:                     enabled
  Address Standardizer support:       enabled
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23

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)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

安装

用yum安装相关依赖

yum install cmake   libxml2 libxml2-devel gettext json-c json-c-devel   gmp-devel mpfr-devel boost-devel pcre2-devel
  • 1

编译安装proj-4.9

./configure
make
make install
  • 1
  • 2
  • 3

编译安装geo3.8:

sh autogen.sh
./configure
make
make install
  • 1
  • 2
  • 3
  • 4

编译安装gdal-2.4.4:

./configure --prefix=/opt/gdal-2.4.4
make
make install
  • 1
  • 2
  • 3

编译安装CGAL:4.7

cmake -DCMAKE_INSTALL_PREFIX=/opt/cgal-CGAL-4.7 .
make 
make install
  • 1
  • 2
  • 3

编译安装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
  • 1
  • 2
  • 3
  • 4

编译安装protobuf-c-1.1.1

./configure
make
make install
  • 1
  • 2
  • 3

修改/etc/ld.so.conf,增加:

/usr/local/lib64/
/usr/local/lib/
/opt/cgal-releases-CGAL-4.7/lib64/
/opt/gdal-2.4.4/lib/
  • 1
  • 2
  • 3
  • 4

编译安装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
  • 1
  • 2
  • 3
  • 4

configure后显示:

 -------------- Dependencies --------------
  GEOS config:          /usr/local/bin/geos-config
  GEOS version:         3.8.4
  GDAL config:          /opt/gdal-2.4.4/bin/gdal-config
  GDAL version:         2.4.4
  SFCGAL config:        /opt/cgal-releases-CGAL-4.7/bin/sfcgal-config
  SFCGAL version:       1.2.2
  PostgreSQL config:    /usr/local/pgsql/bin/pg_config
  PostgreSQL version:   PostgreSQL 12.4
  PROJ4 version:        49
  Libxml2 config:       /usr/bin/xml2-config
  Libxml2 version:      2.9.1
  JSON-C support:       yes
  protobuf-c support:   yes
  protobuf-c version:   1001001
  PCRE support:         yes
  Perl:                 /usr/bin/perl
   --------------- Extensions ---------------
  PostgreSQL EXTENSION support:       enabled
  PostGIS Raster:                     enabled
  PostGIS Topology:                   enabled
  SFCGAL support:                     enabled
  Address Standardizer support:       enabled
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/589754
推荐阅读
  

闽ICP备14008679号