首页 > 解决方案 > 如何为 postgresql 9.6 安装 postgis

问题描述

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

sudo apt-get install postgresql-9.6

但是当我输入:

sudo apt get install postgis

我突然得到那个版本的 postgres 10 和 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

标签: postgresqlinstallationpostgis

解决方案


在 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

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


推荐阅读