![从可信赖的反向移植版本安装最新版本的 Apache 2.4 会引发依赖性错误](https://linux22.com/image/883775/%E4%BB%8E%E5%8F%AF%E4%BF%A1%E8%B5%96%E7%9A%84%E5%8F%8D%E5%90%91%E7%A7%BB%E6%A4%8D%E7%89%88%E6%9C%AC%E5%AE%89%E8%A3%85%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC%E7%9A%84%20Apache%202.4%20%E4%BC%9A%E5%BC%95%E5%8F%91%E4%BE%9D%E8%B5%96%E6%80%A7%E9%94%99%E8%AF%AF.png)
我正在尝试安装最新版本的 Apache 2.4。但是:
$ sudo apt-get install apache2=2.4.*
Reading package lists... Done
Building dependency tree
Reading state information... Done
Selected version '2.4.10-1ubuntu1.1~ubuntu14.04.1' (Ubuntu:14.04/trusty-backports [i386]) for 'apache2'
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:
apache2 : Depends: apache2-bin (= 2.4.10-1ubuntu1.1~ubuntu14.04.1) but 2.4.7-1ubuntu4.10 is to be installed
Depends: apache2-data (= 2.4.10-1ubuntu1.1~ubuntu14.04.1) but 2.4.7-1ubuntu4.10 is to be installed
E: Unable to correct problems, you have held broken packages.
不同的存储库中确实有针对2.4.7
和的软件包:2.4.10
$ apt-cache policy apache2-data
apache2-data:
Installed: (none)
Candidate: 2.4.7-1ubuntu4.10
Version table:
2.4.10-1ubuntu1.1~ubuntu14.04.1 0
100 http://archive.ubuntu.com/ubuntu/ trusty-backports/main i386 Packages
2.4.7-1ubuntu4.10 0
500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main i386 Packages
2.4.7-1ubuntu4.5 0
500 http://security.ubuntu.com/ubuntu/ trusty-security/main i386 Packages
2.4.7-1ubuntu4 0
500 http://archive.ubuntu.com/ubuntu/ trusty/main i386 Packages
但是,我不知道它们的依赖关系是如何混淆的,以至于出现上述错误。
答案1
Backports 存储库设置为不从 Ubuntu 的默认实例中安装(优先级 500 高于 100,这在您的输出中显示;这也是一段时间以来的标准)。要从存储库安装所有依赖项trusty-backports
,我们必须做两件事之一来让 apt 知道我们想要它做什么(是的,apt
而且apt-get
并不像我们希望的那样聪明):
(1)指定要从 backport 安装的所有依赖项,packagename/trusty-backports
除非您知道所有依赖包,否则这种方法很麻烦,或者更简单的方法......
(2)告诉我们,apt-get
当我们运行命令时,我们要专门使用它的反向移植作为安装的“目标版本”。
sudo apt-get -t trusty-backports install apache2
然后,这将从 backports 存储库中提取依赖项,并相应地升级 Apache 软件。