Apacheのインストール中にエラーが発生しました。エラーは「E:サブプロセス/usr/bin/dpkgがエラーコード(1)を返しました」です。

Apacheのインストール中にエラーが発生しました。エラーは「E:サブプロセス/usr/bin/dpkgがエラーコード(1)を返しました」です。

オンラインで記事をフォローしました。私のApacheを削除 私のシステムでは。
このコマンドでApacheを削除しました。

sudo apt-get purge apache2 apache2-utils
sudo rm -rf /etc/apache2-bin
sudo apt-get autoremove

その後、記事から削除を参照してくださいwhereis apache2

whereis apache2私が見つけたコマンドを実行した後

/usr/sbin/apache2/usr/share/apache2
/usr/lib/apache2
/usr/share/man/man8/apache2.8.gz
/etc/apache2

コマンドで上記のディレクトリとファイルを削除しましたsudo rm -rf file_or_directory_name

それから試しました。

sudo apt-get install apache2

私はクリックしました「あなた」尋ねたときdo you want to continue?

その後、エラーが発生します。

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)

sudo apt-get install apache2コマンドを実行して再試行しましたが、sudo apt-get updateまだ同じエラーの結果が発生しました。

ベストアンサー1

復元するには、再インストールする/usr/share/apache2/default-site/index.html必要がありますapache2-data。現在の状況を考慮して試してください。

sudo apt-get purge apache2-data
sudo apt-get install apache2

apt-get autoremoveおそらく削除しなかったが、含まれているファイルを削除したapache2-dataため、システムはその状態になったようです。rm -rfそれではまだインストールされていて、再インストールする必要はないとapt-get install apache2思いますが、そのファイルは消えました。apache2-data

おすすめ記事