我正在尝试安装最新版本的 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 软件。