无法安装Apache2

试图在ubuntu 14.04上安装apache2,但出现以下错误

sudo apt-get install apache2 Reading package lists... Done Building dependency tree Reading state information... Done 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.7-1ubuntu4.6) but it is not going to be installed E: Unable to correct problems, you have held broken packages. 

运行它通常可以解决软件包的问题:

 sudo apt-get update 

这也可能有助于:

 sudo apt-get upgrade 

看这个 Linode指南。

看起来你的系统中有些软件包坏了,首先修复它们

 dpkg --configure -a sudo apt-get -f install 

然后

 sudo apt-get install apache2-bin apache2 OR sudo aptitude install apache2-bin apache2 

这应该解决您的问题。

通过以下两个步骤解决了这个问题。

  sudo echo "deb http://archive.ubuntu.com/ubuntu trusty main universe restricted multiverse" > /etc/apt/sources.list sudo apt-get update 

现在工作:)

add-apt-repository不是一个包,所以你不能使用sudo apt-get install add-apt-repository来安装它。

包含add-apt-repository命令的软件包是(而且一直是):

software-properties-common

而不是你可能会想到的python-software-properties。 您可以使用以下命令来检查它:

dpkg -S add-apt-repository