我需要在我的 ubuntu 系统上安装 apache2。运行以下命令:
sudo apt-get 安装 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 : PreDepends: dpkg (>= 1.17.14)
E: Unable to correct problems, you have held broken packages.
我查看了其他类似的问题并尝试这样做:
sudo apt-get install -f
sudo dpkg --purge --force-depends "apache*"
sudo apt-get install apache2
但是第二条命令说:
sudo dpkg --purge --force-depends "apache*"
dpkg: error: --purge needs a valid package name but 'apache*' is not: illegal package name in specifier 'apache*': character `*' not allowed (only letters, digits and characters `-+._')
我上网查了一下,有人说这可能是由于安装了 php7 造成的。我不明白为什么会这样,也无法解决这个错误。请帮忙
编辑: lsb_release -a 的输出; uname -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.4 LTS
Release: 14.04
Codename: trusty
Linux myprecious 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
我有那个候选人以及另一个最新的候选人:
2.4.12-2 0 500 ppa.launchpad.net/cybersec/chaos-ppa-v2/ubuntu trusty/main amd64 Packages
答案1
apache2
您启用的第三方存储库中的软件包需要dpkg
版本 1.17.14 或更高版本的软件包。此版本不适用于 Trusty。因此,请安装apache2
Trusty 的官方软件包,当前版本为 2.4.7-1ubuntu4.9。
正如你在输出中看到的apt-cache policy
2.4.12-2 0 500 ppa.launchpad.net/cybersec/chaos-ppa-v2/ubuntu trusty/main amd64 Packages
您的第三方 PPA 是https://launchpad.net/~cybersec/+archive/ubuntu/chaos-ppa-v2
清除
sudo ppa-purge ppa:cybersec/chaos-ppa-v2
并安装apache2
sudo apt-get install apache2