
我剛剛從我的 ubuntu 16.04 系統中刪除了一個軟體包。刪除包後,終端機會顯示一些警告,如下所示:
Removing gitlab-ce (8.10.4-ce.0) ...
Purging configuration files for gitlab-ce (8.10.4-ce.0)...
dpkg: warning: while removing gitlab-ce, directory '/opt/gitlab/sv' not empty so not removed
dpkg: warning: while removing gitlab-ce, directory '/opt/gitlab/etc' not empty so not removed
dpkg: warning: while removing gitlab-ce, directory '/opt/gitlab/service' not empty so not removed
dpkg: warning: while removing gitlab-ce, directory '/opt/gitlab/embedded/cookbooks' not empty so not removed
dpkg: warning: while removing gitlab-ce, directory '/opt/gitlab/embedded/ssl/certs' not empty so not removed
dpkg: warning: while removing gitlab-ce, directory '/opt/gitlab/embedded/service/gitlab-rails/public' not empty so not emoved
dpkg: warning: while removing gitlab-ce, directory '/opt/gitlab/embedded/service/gitlab-rails/config/initializers' not empty so not removed
dpkg: warning: while removing gitlab-ce, directory '/opt/gitlab/embedded/service/gitlab-shell' not empty so not removed
dpkg: warning: while removing gitlab-ce, directory '/opt/gitlab/init' not empty so not removed
它說該/opt/gitlab/
目錄不為空,因此無法從系統中刪除它們。
我是否應該手動刪除這些目錄?
答案1
該目錄在安裝後填入命令,並保存變數資料以及與套件gitlab-ce reconfigure
相關的配置。gitlab-ce
推薦的卸載過程是
刪除服務
sudo gitlab-ctl uninstall
清理使用該套件產生的所有數據
sudo gitlab-ctl cleanse
您可能還想刪除您配置的任何帳戶。這樣做
sudo gitlab-ctl remove-accounts
然後使用刪除包
sudo dpkg -P gitlab-ce
此外,gitlab-ce 使用這些目錄(如所述這裡)
/opt/gitlab
保存 GitLab 及其相依性的應用程式程式碼。/var/opt/gitlab
保存 gitlab-ctl reconfigure 寫入的應用程式資料和設定檔。/etc/gitlab
儲存omnibus-gitlab 的設定檔。這些是您應該手動編輯的唯一文件。/var/log/gitlab
包含由omnibus-gitlab元件產生的所有日誌資料。
因此,請先刪除建議的軟體包(即使您需要重新安裝它)。然後您可以安全地刪除這些資料rm
。
從omnibus-gitlab找到的訊息自述文件頁面
答案2
我是否應該手動刪除這些目錄?
檔案系統層次結構標準為了/opt/
:
/opt、/var/opt 和 /etc/opt 層次結構之外不得存在其他套件文件,但必須駐留在檔案系統樹中特定位置才能正常運作的套件檔案除外。例如,裝置鎖定檔案必須放置在 /var/lock 中,裝置必須位於 /dev 中。
其中的任何內容/opt/
都是由卸載腳本維護的,該腳本基本上會關閉服務(如果需要)和一堆rm
。因此,如果您想手動執行此操作,則需要關閉該服務(如果需要),然後再關閉rm
它。
請注意,/opt/
有一個同伴/etc/opt/
可能包含與該包相關的文件。