用 apt-get 刪不乾淨的 remove 參數

2017-01-30 Ubuntu

今天在安裝一台 Apache 2.4 的時候頻頻無法啟動 service 出現以下錯誤訊息

 

$ sudo /etc/init.d/apache2 restart
/etc/init.d/apache2: 46: .: Can't open /etc/apache2/envvars
[....] Restarting apache2 (via systemctl): apache2.serviceJob for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.
 failed!

 

查看 /etc/apache2/envvars 這隻檔案和 apache2.conf 的設定檔都不見了。追查記錄是原先這台已經有安裝過 apache2,但是移除不乾淨,是使用 apt-get remove 移除,因為當你使用 apt-get remove 參數後再重新安裝將不會覆蓋設定檔,如 apache2.conf,envvars ..

 

必須要使用 purge 移除才會乾淨

$ sudo apt-get purge apache2

 

或是用 autoremove 加上 –purge 參數

$ sudo apt-get autoremove --purge

 

然後再安裝一次,設定檔就會重新生成

$ sudo apt-get install apache2

 

 

給 Mr. 沙先生一點建議

彙整

分類

展開全部 | 收合全部

License

訂閱 Mr. 沙先生 的文章

輸入你的 email 用於訂閱