apache2-bin をインストールしようとするとエラーが発生します

apache2-bin をインストールしようとするとエラーが発生します

設定が欠落しているか壊れているために apache2 を再起動できないため、apache2-bin をインストールしようとしています。また、apache2 が実行されていないと、Web サイトがダウンしたり、適切にリダイレクトされません。インストールしようとすると、次のエラーが発生します。

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://ローカルホスト

関連情報