首次无法安装 apache2

首次无法安装 apache2

我正在尝试安装本地服务器,但似乎无法解决安装 apache 时出现的这个错误。

在我的终端上运行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.9) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我该如何修复这个问题?我是 Linux 新手,所以才这样。

答案1

看来您的系统中以前安装过 apache。我会首先尝试apt-get install -f --reinstall apache2-f以修复未满足的依赖关系。如果这不能解决问题,我会尝试apt-get remove --purge -s apache2。清除将删除配置文件,并将-s进行“测试卸载”(不删除任何内容),因此您可以检查将删除哪些软件包(它们应该只是与 apache2 相关的软件包,如果您不确定,请在此处发布输出)。然后apt-get install apache2

相关内容