2015-03-25 65 views
6

我是postgre和Ubuntu的新手。我使用Ubuntu 14.04 LTS Trusty运行虚拟机。我试图安装PostgreSql9.4数据库和PostGIS的2.1.Here是我的Ubuntu的机器上运行的命令:PostGIS-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,并且无法成功。提前感谢您的帮助。谢谢

回答

8

您可能有更高版本的候选软件包在postgresql的存储库,然后在你的官方发行版(因此未满足的依赖)。一种可能的解决方案是通过检查它们是否可用作候选(apt-cache策略)并选择要安装的特定版本(也用于依赖关系),从发行版通道安装相同的软件包。

在我的系统,它看起来如下:

The following packages have unmet dependencies: 
pgadmin3 : Depends: libwxbase3.0-0 (>= 3.0.2) but it is not installable 
      Depends: libwxgtk3.0-0 (>= 3.0.2) but it is not installable 
      Recommends: pgagent but it is not going to be installed 

apt-cache policy pgadmin3 
pgadmin3: 
    Installed: (none) 
    Candidate: 1.20.0-1.pgdg70+1 
    Version table: 
    1.20.0-1.pgdg70+1 0 
     500 http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg/main amd64 Packages 
    1.14.2-2 0 
     500 http://ftp5.gwdg.de/pub/linux/debian/debian/ wheezy/main amd64 Packages 

然后,您希望与安装低版本:

$ sudo apt-get install pgadmin3=1.14.2-2 pgadmin3-data=1.14.2-2 
+1

谢谢,这也有助于Linux mint 18。 – Lazyexpert 2016-09-05 07:22:03

2

对于添加了PostGIS,连接我刚刚张贴到Ubuntu的答案:https://askubuntu.com/questions/621383/installing-postgis-on-ubuntu-15-04

快速回顾:我也是Ubuntu新手,但我的理解是a)postgresql-9.4还没有为ubuntu构建的postgis和b)有一个版本compat ubuntugis和值得信赖的,步骤之间ibility问题我曾经是修复:

  1. 选或移除/etc/apt/sources.list ubuntugis( “其他软件” 选项卡)

  2. 安装与sudo apt-get install postgresql-9.3-postgis-2.1(注意:使用apt-cache search postgresql-9看什么PostGIS的版本都可以)

  3. 确认安装与psql,在psql里运行CREATE EXTENSION postgis;,并确认与\dx

  4. 添加
0

这是我做的,以最后安装pgadmin3:

首先我检查库中的可用版本:

apt-cache policy pgadmin3 

然后安装该版本(可随时间而改变,使用正确的版本由前面的命令显示):

sudo apt-get install pgadmin3=1.22.2-1 pgadmin-data=1.22.2-1