从系统中删除gitlab包后手动删除/opt/gitlab/目录可以吗?

viv*_*vek 26 package-management uninstall apt gitlab

我刚刚从我的 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 
Run Code Online (Sandbox Code Playgroud)

它说该/opt/gitlab/目录不是空的,所以它不能从系统中删除那些。

我应该手动删除这些目录吗?

Anw*_*war 52

该目录gitlab-ce reconfigure在安装后填充命令并保存变量数据,与gitlab-ce包相关的配置。

推荐的卸载过程是

  1. 删除服务

     sudo gitlab-ctl uninstall
    
    Run Code Online (Sandbox Code Playgroud)
  2. 清理使用包生成的任何数据

     sudo gitlab-ctl cleanse
    
    Run Code Online (Sandbox Code Playgroud)
  3. 您可能还想删除您配置的任何帐户。这样做

     sudo gitlab-ctl remove-accounts
    
    Run Code Online (Sandbox Code Playgroud)
  4. 然后使用删除包

     sudo dpkg -P gitlab-ce
    
    Run Code Online (Sandbox Code Playgroud)

此外,gitlab-CE使用这些目录(如所描述的在这里

  • /opt/gitlab 保存 GitLab 及其依赖项的应用程序代码。
  • /var/opt/gitlab 保存 gitlab-ctl reconfigure 写入的应用程序数据和配置文件。
  • /etc/gitlab保存 omnibus-gitlab 的配置文件。这些是您必须手动编辑的唯一文件。
  • /var/log/gitlab 包含由 omnibus-gitlab 的组件生成的所有日志数据。

所以,首先删除包推荐的方式(即使你需要重新安装它)。然后,您可以rm安全地删除这些数据。

从 omnibus-gitlab README 页面找到的信息

  • 这甚至在最新版本的 Gitlab 12.0.2-ee.0 中也有效,只需进行一个更改:您应该编写 gitlab-ee 而不是 sudo dpkg -P gitlab-ce (2认同)

Rin*_*ind 11

我应该手动删除这些目录吗?

文件系统层次标准/opt/

除了那些必须驻留在文件系统树中特定位置才能正常运行的包文件之外,在 /opt、/var/opt 和 /etc/opt 层次结构之外不得存在其他包文件。例如,设备锁定文件必须放在 /var/lock 中,设备必须位于 /dev 中。

中的任何内容/opt/都由卸载脚本维护,该脚本基本上会关闭服务(如果需要)和一堆rm's. 因此,如果您想手动执行此操作,则需要关闭服务(如果需要),然后再关闭rm

注意/opt/有一个/etc/opt/可能包含与该包相关的文件的伴侣。