背景

服务器上的pgsql-14.5是源码安装的,现在需要安装postgis插件,使用yum方式安装postgis 

yum安装postgis参考:https://www.cnblogs.com/lqqgis/p/15075208.html

插件安装完毕后,

postgis用yum方式安装后的路径在:/usr/pgsql-14

 postgis 用源码方式安装后的路径在:/usr/local/pgsql

 第一次执行:CREATE EXTENSION postgis; 开启postgis扩展插件时,报错:

报错:/usr/local/pgsql/share/extension/postgis.control 没有这个文件

排查: 去对应目录下寻找,确实没有postgis.control 文件,后经 find / -name "postgis.control" 查询后发现在/usr/pgsql-14/share/extension目录下

解决:为了解决这个问题,我尝试将 postgresql中的 /usr/local/pgsql/share/extension目录进行备份, (原目录 /usr/local/pgsql/share/extension下的plpgsql--1.0.sql,plpgsql.control文件,和/usr/pgsql-14/share/extension/下的plpgsql--1.0.sql,plpgsql.control文件是一样的。)

然后创建软连接 ln -s /usr/pgsql-14/share/extension  extension

最终效果如下:

第二次执行 CREATE EXTENSION postgis; 开启postgis扩展插件时,报错:

报错:could not access file"$libdir/postgis-3": 没有那个文件或目录

排查:postgis-3 这个文件存在于postgis的目录/usr/pgsql-14中,而不在postgresql的目录中/usr/local/pgsql;

我再次尝试在/usr/local/pgsql/lib下 创建软连接

 第三次执行CREATE EXTENSION postgis; 开启postgis扩展插件时,显示执行成功;(下图是执行成功再次执行后的效果)

说明:这种尝试创建超链接的操作可能带来的隐患或问题,还在排查中,

另外本篇属个人备忘记录,不喜勿喷 

附带执行其他扩展:

另外执行如下操作,也是可以的

CREATE EXTENSION address_standardizer;
CREATE EXTENSION postgis_sfcgal;
CREATE EXTENSION address_standardizer_data_us; 

下面这两个执行时会显示错误: 

CREATE EXTENSION fuzzystrmatch;  

报错:ERROR:  could not open extension control file "/usr/local/pgsql/share/extension/fuzzystrmatch.control": 没有那个文件或目录


CREATE EXTENSION postgis_tiger_geocoder;   

 

解决办法:下面这博客中有说。

http://t.csdn.cn/WHnX9 

could not open extension control file "/usr/local/pgsql/share/extension/fuzzystrmatch.control"_yufenghyc的博客-CSDN博客ERROR: could not open extension control file "/usr/local/pgsql/share/extension/"https://blog.csdn.net/yufenghyc/article/details/50777211

再次执行,ok

CREATE EXTENSION fuzzystrmatch;  CREATE EXTENSION postgis_tiger_geocoder;   

其他参考文档:

postgis扩展部分:  https://www.cnblogs.com/cscshi/p/16582790.html

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐