postgreSQL插件
# pg12 yum安装postgis
Centos
安装repo源:
rpm -ivh https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
安装包(postgis30_12):
yum install postgis30_12.x86_64 postgis30_12-client.x86_64 postgis30_12-debuginfo.x86_64 postgis30_12-devel.x86_64 postgis30_12-docs.x86_64 postgis30_12-gui.x86_64 postgis30_12-utils.x86_64
登录数据库:
创建:CREATE EXTENSION postgis;
检查:SELECT PostGIS_version();
# 麒麟系统编译安装postgis-2.5.6
- 系统信息
cmake version 3.12.1
- 安装需要依赖库
#Centos 服务器系统
yum install libcurl-devel curl openssl-devel -y
#Ubuntu 麒麟桌面系统
apt-get install libcurl4-openssl-dev openssl-dev
2
3
4
5
- Kylin Linux Advanced Server
#这三个是必须的
https://github.com/libgeos/geos/tags
https://github.com/OSGeo/gdal/tags
https://github.com/OSGeo/PROJ/tags
https://github.com/protobuf-c/protobuf-c/tags
https://github.com/json-c/json-c/tags
http://xmlsoft.org/downloads.html
https://gitlab.com/Oslandia/SFCGAL/-/releases
2
3
4
5
6
7
8
9
10
#必须
wget https://download.osgeo.org/postgis/source/postgis-2.5.6.tar.gz
wget https://github.com/OSGeo/gdal/archive/refs/tags/v3.5.0.tar.gz
wget https://github.com/libgeos/geos/archive/refs/tags/3.8.2.tar.gz
wget https://github.com/OSGeo/PROJ/archive/refs/tags/7.2.0.tar.gz
wget https://github.com/google/googletest/archive/release-1.8.1.zip
#看需求
wget https://gitlab.com/Oslandia/SFCGAL/-/archive/v1.3.7/SFCGAL-v1.3.7.tar.gz
wget https://github.com/protobuf-c/protobuf-c/archive/refs/tags/v1.4.0.tar.gz
wget https://github.com/json-c/json-c/archive/refs/tags/json-c-0.15-20200726.tar.gz
2
3
4
5
6
7
8
9
10
11
postgis版本不建议用太高,需要的make版本会要求更高c
# geos-3.8.2 (必须安装)
libgeos-geos3.8.2.tar.gz: wget https://github.com/libgeos/geos/archive/refs/tags/3.8.2.tar.gz
tar xf libgeos-geos3.8.2.tar.gz
cd geos-3.8.2/
mkdir build
cd build/
cmake ../
echo $?
make -j $(nproc)
make install
echo $?
2
3
4
5
6
7
8
9
# PROJ-7.2.0 (必须安装)
OSGeo-PROJ7.2.0.tar.gz: wget https://github.com/OSGeo/PROJ/archive/refs/tags/7.2.0.tar.gz
PROJ依赖包: wget https://github.com/google/googletest/archive/release-1.8.1.zip
tar xf OSGeo-PROJ7.2.0.tar.gz
cd PROJ-7.2.0/
mkdir -p build/googletest-download/googletest-prefix/src
cd build/
#上传包release-1.8.1.zip
mv release-1.8.1.zip /opt/soft/PROJ-7.2.0/build/googletest-download/googletest-prefix/src/release-1.8.1.zip
cd build/
cmake ../
echo $?
make -j $(nproc)
make install
echo $?
2
3
4
5
6
7
8
9
10
11
12
# gdal-3.5.0 (必须安装)
OSGeo-gdalv3.5.0.tar.gz: wget https://github.com/OSGeo/gdal/archive/refs/tags/v3.5.0.tar.gz
tar xf OSGeo-gdalv3.5.0.tar.gz
cd gdal-3.5.0/
ll
mkdir build
cd build/
cmake ../
make -j $(nproc)
make install
echo $?
2
3
4
5
6
7
8
9
# 编译postgis-2.5.6
find / -name pg_config
,先找一下pg_config在哪里
ln -s /opt/postgresql/lib/libpq.so.5.12 /usr/local/lib/libpq.so.5
tar xf postgis-2.5.6.tar.gz
cd postgis-2.5.6
./configure --prefix=/usr/local/postgis --with-pgconfig=/opt/postgresql/bin/pg_config
make -j $(nproc)
make install
echo $?
2
3
4
5
6
7
8
# 使用ldd查看postgis-2.5.so,创建软链接
使用ldd命令查看,如果有“not found”,查找该so文件,添加软链接,如果找不到对应的so,那就是上面编译有问题
ldd /opt/postgresql/lib/postgis-2.5.so
ldd /opt/postgresql/lib/rtpostgis-2.5.so
ln -s /usr/local/lib64/libproj.so.19 /lib64/libproj.so.19
ln -s /usr/local/lib/libgeos_c.so.1 /lib64/libgeos_c.so.1
ln -s /usr/local/lib/libgeos.so.3.8.2 /lib64/libgeos.so.3.8.2
ln -s /usr/local/lib64/libgdal.so.31 /lib64/libgdal.so.31
ln -s /usr/local/lib/libproj.so.12.0.0 /usr/lib64/libproj.so.12 #在
2
3
4
5
6
# 创建postgis,检查
CREATE EXTENSION postgis;
COMMENT ON EXTENSION postgis IS 'PostGIS geometry, geography, and raster spatial types and functions';
2
3
# 个人存储下载地址。。。
#yum包
postgis-12.14.zip
源码安装包
postgresql12.10-postgis2.5.6.zip
2
3
4
5
6