我问这在 SO 上,但现在我认为问题主要是包管理,并且属于这里。
根据原始帖子中可以找到的所有细节,我已经尝试过(sudo 被消除,因为是多余的):
$ apt list | grep gdal | grep installed
gdal-bin/trusty,now 1.11.0+dfsg-1~exp2~trusty1 amd64 [installed]
libgdal1h/trusty,now 1.11.0+dfsg-1~exp2~trusty1 amd64 [installed,automatic]
$ apt-get purge gdal-bin
$ apt-get purge libdal1h
$ add-apt-repository ppa:ubuntugis/ppa
$ apt-get update
W: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/dists/trusty/main/binary-amd64/Packages 404 Not Found
W: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/dists/trusty/main/binary-i386/Packages 404 Not Found
显然有些东西配置错误了...我不知道我这边该检查什么...
然后
$ fab vagrant.Provision # see the original question above for what this is doing at the linux level
这仍然会遇到完全相同的依赖性问题libdal1
:libgdal1h
[localhost] sudo: DEBIAN_FRONTEND=noninteractive apt-get install --quiet --assume-yes postgresql-9.3-postgis-2.1
[localhost] out: {...}
[localhost] out: Some packages could not be installed. This may mean that you have
[localhost] out: requested an impossible situation or if you are using the unstable
[localhost] out: distribution that some required packages have not yet been created
[localhost] out: or been moved out of Incoming.
[localhost] out: The following information may help to resolve the situation:
[localhost] out:
[localhost] out: The following packages have unmet dependencies:
[localhost] out: postgresql-9.3-postgis-2.1 : Depends: libgdal1 (>= 1.9.0) but it is not going to be installed
[localhost] out: Recommends: postgis but it is not going to be installed
[localhost] out: E: Unable to correct problems, you have held broken packages.
更多信息 :
vagrant@ubuntu-14:~$ apt-cache policy postgresql-9.3-postgis-2.1
postgresql-9.3-postgis-2.1:
Installed: (none)
Candidate: 2.1.3+dfsg-3.pgdg12.4+2
Version table:
2.1.3+dfsg-3.pgdg12.4+2 0
500 http://apt.postgresql.org/pub/repos/apt/ precise-pgdg/main amd64 Packages
2.1.2+dfsg-2 0
500 http://us.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
答案1
正如@saircot895 引导我发现的那样,问题在于存储库之间存在冲突。我提出的问题中没有看到具体细节,因为我没有深入研究用于设置相关虚拟 Ubuntu 盒的 Fabric 脚本。实际上,该脚本使用的是较旧的“Precise”版本作为 postgres 本身,但 postgis 使用的是较新的“Trusty”。将 postgres 安装(以及其余配置)更改为较新的版本解决了该问题。
答案2
我已经成功(没有任何损坏的依赖项)安装了postgresql-9.1-postgis-2.0
。postgresql-9.1-postgis
并且数据库运行正常。