今天在Ubuntu服務器上安裝supervisor,部署沒成功想卸載重來,sudo apt-get remove supervisor 后發現組態檔還在,便手動洗掉了組態檔,再次安裝,提示組態檔不存在,WTF!組態檔不該你軟體給我創建嗎?我想,
查閱資料才知,還有 apt-get purge 這一選項,purge 清除,
劃重點:
apt-get remove 會洗掉軟體包而保留軟體的組態檔
apt-get purge 會同時清除軟體包和軟體的組態檔
但是為什么重新安裝會失敗呢?
系統中存在dpkg這么一個工具,會記錄軟體包的狀態,不只是安裝和未安裝兩種狀態,會記錄以下這些狀態:
not-installed - The package is not installed on this system
config-files - Only the configuration files are deployed to this system
half-installed - The installation of the package has been started, but not completed
unpacked - The package is unpacked, but not configured
half-configured - The package is unpacked and configuration has started but not completed
triggers-awaited - The package awaits trigger processing by another package
triggers-pending - The package has been triggered
installed - The packaged is unpacked and configured OK
當執行apt-get install時,apt軟體包管理工具會先檢查要安裝的軟體的狀態,向我這種情況下,手動洗掉了軟體配置后,并不會引起dpkg中記錄的狀態的改變,即仍為 config-files 狀態,所以安裝程序會直接跳過創建組態檔這一程序,于是當軟體想要啟動行程的時候,才發現找不到檔案,
所以當你想徹底地洗掉軟體包的時候,用 apt-get purge 吧
原文:http://bencane.com/2014/08/18/removing-packages-and-configurations-with-apt-get/
作者:hukx_michael
鏈接:https://www.jianshu.com/p/f6176973b56f
來源:簡書
著作權歸作者所有,商業轉載請聯系作者獲得授權,非商業轉載請注明出處,
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/141387.html
標籤:Linux
