如何为postgresql9.6安装postgis



我想为它安装Postgres 9.X和Postgis。我设法用以下命令安装了版本为9.6的Postgres:

sudo apt-get install postgresql-9.6

但是当我输入:

sudo apt get install postgis

我突然得到了postgres10和postgis的那个版本。

当我在这个链接上尝试类似的东西时http://technobytz.com/install-postgis-postgresql-9-3-ubuntu.html我的安装失败了,我在终端中得到了这个代码:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
postgresql-9.3-postgis-2.1 : Depends: libgdal1 (>= 1.9.0) but it is not going to be installed
Depends: libgeos-c1 (>= 3.3.3) but it is not going to be installed
Depends: liblwgeom-2.1.8 (>= 2.1.6) but it is not going to be installed
Depends: libproj0 but it is not installable
Recommends: postgresql-contrib-9.3 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我使用的是Ubuntu 18.04

在ubuntu上,您可以使用以下命令:

sudo apt-get install postgresql-<xx>-postgis-<yy> postgresql-<xx>-postgis-<yy>-scripts

例如

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

只需选择您需要的正确版本即可。

最新更新