我是postgre和Ubuntu的新手 . 我正在使用Ubuntu 14.04 LTS Trusty运行VM . 我正在尝试安装PostgreSql9.4数据库和PostGIS 2.1 . 这是我在Ubuntu机器上运行的命令:
sudo apt-get install wget ca-certificates
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt trusty-pgdg main" >> /etc/apt/sources.list'
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install postgresql-9.4-postgis-2.1 pgadmin3 postgresql-contrib
但是我收到以下错误 .
The following packages have unmet dependencies:
pgadmin3 : Depends: libwxbase3.0-0 (>= 3.0.0) but it is not installable
Depends: libwxgtk3.0-0 (>= 3.0.0) but it is not installable
Recommends: pgagent but it is not going to be installed
postgresql-9.4-postgis-2.1 : Depends: libgdal1h (>= 1.9.0) but it is not installable
Depends: libgeos-c1 (>= 3.4.2) but it is not installable
Depends: liblwgeom-2.1.5 (>= 2.1.2) but it is not going to be installed
Depends: libproj0 (>= 4.8.0-1) but it is not installable
E: Unable to correct problems, you have held broken packages.
我搜索了几个地方,看到了很多回复,但没有一个对我有用 . 我也试过PostgreSQL9.3并且也没能成功 . 谢谢你的帮助 . 谢谢
3 回答
您可能在postgresql的存储库中有更高版本的候选版本,然后在您的官方发行版中(因此未完成的依赖项) . 一种可能的解决方案是通过检查它们是否可用作候选(apt-cache策略)并选择要安装的特定版本(也用于依赖项)来从发行版通道安装相同的软件包 .
在我的系统上,它看起来如下:
然后,您希望安装较低版本:
要添加PostGIS,请将我刚发布的答案链接到Ubuntu:https://askubuntu.com/questions/621383/installing-postgis-on-ubuntu-15-04
快速回顾:我也是Ubuntu的新手,但我的理解是a)postgresql-9.4还没有为ubuntu构建的postgis和b)ubuntugis和trusty之间存在版本兼容性问题,我以前修复的步骤是:
从/etc/apt/sources.list中取消选中或删除ubuntugis(“其他软件”标签)
安装
sudo apt-get install postgresql-9.3-postgis-2.1
(注意:使用apt-cache search postgresql-9
查看可用的postgis版本)使用
psql
确认安装,在psql中运行CREATE EXTENSION postgis;
,并使用\dx
确认添加这是我最终安装pgadmin3所做的:
首先,我检查了存储库中的可用版本:
然后安装该版本(可能会及时更改,使用上一个命令显示的正确版本):