安装 apache 时出现 /usr/bin/dpkg 问题

安装 apache 时出现 /usr/bin/dpkg 问题

我想我可能在卸载 Apache 时删除了一个重要的目录,在尝试安装 Apache 时我遇到了以下问题:

Setting up apache2 (2.4.7-1ubuntu4.4) ...
cp: cannot stat '/usr/share/apache2/default-site/index.html': No such file or directory
dpkg: error processing package apache2 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 apache2
Reading package lists...
Building dependency tree...
Reading state information...
apache2 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 187 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up apache2 (2.4.7-1ubuntu4.4) ...
cp: cannot stat '/usr/share/apache2/default-site/index.html': No such file or directory
dpkg: error processing package apache2 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 apache2
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

运行以下命令:

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

然后尝试清除 apache

sudo apt-get purge apache2  apache2-data apache2-utils

相关内容