要卸载 GitLab(Omnibus 方式安装) 在 Debian / Ubuntu 上,可以按下面步骤来,比较干净、安全。
sudo gitlab-ctl stop
dpkg -l | grep gitlab
常见包名:
gitlab-eegitlab-cesudo apt remove --purge gitlab-ee
或
sudo apt remove --purge gitlab-ce
⚠️ 不要直接 apt autoremove,先确认 GitLab 已卸载。
GitLab 默认数据目录 不会 随卸载自动删除。
sudo rm -rf /var/opt/gitlab
sudo rm -rf /etc/gitlab
sudo rm -rf /opt/gitlab
说明:
/var/opt/gitlab:数据(仓库、数据库、上传文件)/etc/gitlab:配置文件/opt/gitlab:程序本体sudo deluser --remove-all-files git
sudo deluser --remove-all-files gitlab-www
sudo deluser --remove-all-files gitlab-redis
sudo deluser --remove-all-files gitlab-psql
如果提示用户不存在可以忽略。
如果你不再使用 GitLab:
sudo rm -f /etc/apt/sources.list.d/gitlab*
sudo apt update
gitlab-ctl status
dpkg -l | grep gitlab
如果都无输出,说明已完全卸载。
请告诉我:
我可以给你对应卸载方案。
sudo gitlab-ctl stop
sudo apt remove --purge gitlab-ce
sudo rm -rf /var/opt/gitlab /etc/gitlab /opt/gitlab
如果你是 想重装 GitLab 或 迁移到新服务器,我也可以帮你规划步骤。