postgresql 如何更改安装postgis的位置?postgres

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41666196/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 02:29:51  来源:igfitidea点击:

how to change install postgis location? postgres

databasepostgresqlubuntupostgis

提问by Tsuna

When I am in my postgres db and tried to create an extension for my db, I get this error

当我在我的 postgres 数据库中并尝试为我的数据库创建扩展时,我收到此错误

ERROR: could not open extension control file "/usr/share/postgresql/9.5/extension/postgis.control": No such file or directory

ERROR: could not open extension control file "/usr/share/postgresql/9.5/extension/postgis.control": No such file or directory

I know there are so many posts out there with this error and solutions and I tried them all too. Found so much in stackoverflow but none of them worked.

我知道有很多帖子都有这个错误和解决方案,我也都试过了。在 stackoverflow 中发现了很多,但没有一个起作用。

I realized in my postgresqldirectory there are 9.2, 9.3, 9.4, 9.5, 9.6,

我意识到在我的postgresql目录中有9.2, 9.3, 9.4, 9.5, 9.6,

I went into the directory in the error and I realized there is really no postgis.controlinside 9.5

我走进错误的目录,然后我意识到真的没有postgis.control9.5

I checked my psql version and showed 9.6.1

我检查了我的 psql 版本并显示了 9.6.1

I went into 9.6folder and I DO see a postgis.controlin it.

我进入9.6文件夹,我postgis.control确实在其中看到了一个。

I want to changed the installation directory so when i run

我想更改安装目录,所以当我运行时

create extension postgis

create extension postgis

it would go

它会去

"/usr/share/postgresql/9.6/extension/postgis.control"

"/usr/share/postgresql/9.6/extension/postgis.control"

instead of

代替

"/usr/share/postgresql/9.5/extension/postgis.control"

"/usr/share/postgresql/9.5/extension/postgis.control"

Can someone please give me a hand?

有人可以帮我一把吗?

Thanks in advance.

提前致谢。

P.S. Using Ubuntu 14.04 and also have Ubuntu 16.04 as desktop which I haven't try to install postgis yet

PS 使用 Ubuntu 14.04 并且还有 Ubuntu 16.04 作为桌面,我还没有尝试安装 postgis

回答by Venkatesh Lokare

You should use the following command:

您应该使用以下命令:

sudo apt-get install postgresql-9.6-postgis-scripts

回答by Abdulsatar Aboud

Use the following command to get the postgis.controlin your 9.5 version directory:

使用以下命令获取9.5 版本目录中的postgis.control

sudo apt install postgis postgresql-9.5-postgis-2.3

须藤 apt 安装 postgis postgresql-9.5-postgis-2.3