安装步骤: 参考https://www.postgresql.org/download/linux/redhat/
参考https://www.jianshu.com/p/3f8d77d258d8(94换成96)
https://www.jianshu.com/p/a42f3d308993
安装postgresql:
- 以官方命令方式先安装好postgresql。https://www.postgresql.org/download/linux/redhat/
- 接下来一定要把所有能下载的yum install postgresql96-*全部安装
添加postgis扩展(恶梦开始):
- make参考:https://blog.csdn.net/qq_35732147/article/details/100708103
- 最终使用的各个必装的版本(自己去官网下载):
- proj-5.0.0
- gdal-2.1.2
- geos-3.5.1
- hdf5-1.12.1(安装过程中跳出来提示缺失的)
- json-c-0.13.1
- postgis-2.3.0
其中postgis2.3.0安装时make报错缺失的*.h文件去git上拉取json-c,然后复制到json-c-0.13.1文件make install之后的相应文件夹中
最终的文件目录:
又报错了:ERROR: could not load library "/usr/pgsql-9.6/lib/postgis-2.3.so": /usr/pgsql-9.6/lib/postgis-2.3.so: undefined symbol: geod_init
ERROR: required extension "postgis" is not installed
一顿操作 更改声明 重新源代码安装postgis
vim /etc/ld.so.conf
vim /etc/profile
cd /home/postgis-2.5.1
make uninstall
./configure --prefix=/usr/postgis --with-gdalconfig=/usr/gdal-2.1.2/bin/gdal-config --with-pgconfig=/usr/pgsql-9.6/bin/pg_config --with-geosconfig=/usr/geos-3.7.3/bin/geos-config --with-projdir=/usr/proj-4.9.3 --with-jsondir=/usr/json-c-0.13.1/
查看了好多博客:
postgresql 10.9 源码安装postgis空间数据库扩展模块_枫叶、的博客-CSDN博客
st_frechetdistance函数报错解决(postgis)--Linux - ejQiu - 博客园
搞了三天,依旧失败,心态崩了
最终阿里云重新安装了centos7.9x64系统,按下面这个博客操作,一点错误没报(哪怕一点)
Centos7安装PostgreSQL 12.4 + postgis安装_sunny05296的博客-CSDN博客
centos8安装的时候也是同样的几个步骤,各种问题。
弃了,宁愿多花点时间升级代码到postgresql12,也不要用centos8+postgresql9.6+postgis2了,真是折磨
如果有大神能解决该问题,欢迎在下方贴出你的解决办法,香还是centos8香