在 CentOS 上升级 GitLab(以 Omnibus GitLab 为例,最常见)通常分为 同大版本升级 和 跨大版本升级 两种情况。下面给你一套安全、通用的升级流程。
gitlab-rake gitlab:env:info
# 或
cat /opt/gitlab/version-manifest.txt
gitlab-backup create
备份文件默认在:
/var/opt/gitlab/backups/
⚠️ 如果是生产环境,建议整台服务器或 /var/opt/gitlab 做快照
cat /etc/centos-release
GitLab 16+ 已不再支持 CentOS 7(官方建议迁移到 Rocky / Alma)
yum clean all
yum makecache
yum update gitlab-ee
# 或 gitlab-ce
yum update gitlab-ce
gitlab-ctl reconfigure
gitlab-ctl restart
⚠️ GitLab 不支持跳过主版本升级
14.x → 15.0 → 15.11 → 16.0 → 16.x
yum install gitlab-ce-15.11.13
yum install gitlab-ce-16.0.0
gitlab-ctl reconfigure
gitlab-ctl restart
yum --showduplicates list gitlab-ce
yum install gitlab-ce-16.8.0
gitlab-rake gitlab:env:info
gitlab-ctl status
gitlab-rake gitlab:check
原因:GitLab 16+ 已停止支持
✅ 解决方案:
gitlab-ctl restart
gitlab-rake db:migrate
如果你是用 Docker:
docker pull gitlab/gitlab-ce:latest
docker stop gitlab
docker rm gitlab
# 重新运行新版容器(挂载相同数据目录)
✅ 备份 → 查版本 → 按主版本逐级升级 → reconfigure → 检查
如果你愿意,可以告诉我:
我可以给你 一步不多、一步不少的升级命令方案 ✅