在 Ubuntu 上使用 apt-get 解决未满足的依赖关系

在 Ubuntu 上使用 apt-get 解决未满足的依赖关系

我正在一台Ubuntu 12.04.2 LTS (GNU/Linux 3.5.0-43-generic x86_64)机器上工作。它是一个在生产环境中与其他项目一起运行的服务器,所以我必须非常小心。

我必须安装特定的程序列表,因此首先我运行通常的程序apt-get update,然后继续运行以下命令:

apt-get install python-dev libxslt1-dev libpq-dev git python-pip nginx supervisor wget libxml2-dev mongodb build-essential libxslt1-dev libxrender1 libxext6`

这就是我得到的:

root@SERVERLINUX:~# apt-get install python-dev libxslt1-dev libpq-dev git python-pip nginx supervisor wget libxml2-dev mongodb build-essential libxslt1-dev libxrender1 libxext6
Reading package lists... Done
Building dependency tree       
Reading state information... Done
git is already the newest version.
python-pip is already the newest version.
build-essential is already the newest version.
libxext6 is already the newest version.
libxrender1 is already the newest version.
libxrender1 set to manually installed.
python-dev is already the newest version.
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libpq-dev : Depends: libpq5 (= 9.1.14-0ubuntu0.12.04) but 9.1.9-0ubuntu12.04 is to be installed
             Depends: libkrb5-dev but it is not going to be installed
             Depends: comerr-dev but it is not going to be installed
 libxml2-dev : Depends: libxml2 (= 2.7.8.dfsg-5.1ubuntu4.9) but 2.7.8.dfsg-5.1ubuntu4.6 is to be installed
 linux-image-generic-lts-quantal : Depends: linux-image-3.5.0-44-generic but it is not going to be installed
 mongodb : Depends: mongodb-server but it is not going to be installed
           Depends: mongodb-dev but it is not going to be installed
 nginx : Depends: nginx-full but it is not going to be installed or
                  nginx-light but it is not going to be installed
 supervisor : Depends: python-medusa (>= 0.5.4) but it is not going to be installed
              Depends: python-meld3 but it is not going to be installed
              Depends: python-support (>= 0.90.0) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

我应该怎么做才能安装具有“未满足的依赖项”的软件包?我怎样才能满足这些依赖关系?我害怕按照建议使用该-f选项,因为它可能会把一切搞砸。

答案1

安装失败后,可以使用:

apt-get -f install

这将自动安装请求的包以及所有依赖项,

答案2

您可以尝试找到这些软件包的旧版本并通过以下方式手动安装dpkg -i 包名减少依赖项列表,并可能减少系统的潜在线程。

相关内容