第一次無法安裝apache2

第一次無法安裝apache2

我正在嘗試安裝本機伺服器,但在安裝 apache 時似乎無法克服此錯誤。

在我的終端上運行sudo apt-get install apache2並按 Enter 鍵我得到這個:

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。 Purge 將刪除配置文件,並且-s將進行「測試卸載」(不刪除任何內容),因此您可以檢查將刪除哪些包(它們應該只是 apache2 相關的包,如果您不確定,請在此處發布輸出)。然後apt-get install apache2

相關內容