尝试安装 apache2-bin 时出现错误

尝试安装 apache2-bin 时出现错误

我正在尝试安装 apache2-bin,因为配置丢失或损坏,我无法重新启动 apache2。而且我的网站已关闭或无法在不运行 apache2 的情况下正确重定向。因此,当我尝试安装时,出现了以下错误:

The following NEW packages will be installed:
apache2-bin
0 upgraded, 1 newly installed, 0 to remove and 12 not upgraded.
Need to get 0 B/1067 kB of archives.
After this operation, 3979 kB of additional disk space will be used.
(Reading database ... 106699 files and directories currently installed.)
Preparing to unpack .../apache2-bin_2.4.23-1+deb.sury.org~trusty+1_amd64.deb ...
Unpacking apache2-bin (2.4.23-1+deb.sury.org~trusty+1) ...
dpkg: error processing archive /var/cache/apt/archives/apache2-bin_2.4.23-1+deb.sury.org~trusty+1_amd64.deb (--unpack):
trying to overwrite '/usr/sbin/apache2', which is also in package apache2-mpm-worker 2.2.22-1ubuntu1.11
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/apache2-bin_2.4.23-1+deb.sury.org~trusty+1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)***

答案1

该问题已通过以下响应得到解决:

如何重新安装 apache2?

第一的:

sudo apt-get --purge remove apache2
sudo apt-get autoremove

然后安装 apache2 就很简单了:

sudo apt-get install apache2
sudo /etc/init.d/apache2 restart

测试一下:

山猫http://本地主机

相关内容