Ubuntu系统上GitLab更新步骤
gitlab-rake gitlab:backup:create
备份文件默认存储在/var/opt/gitlab/backups目录下。sudo gitlab-rake gitlab:env:info
或访问GitLab管理界面的“帮助”页面查看版本信息。sudo apt update && sudo apt upgrade -y
若GitLab是通过源码或其他方式安装,需先添加官方软件源以获取最新版本:
curl https://packages.gitlab.com/gpg.key | sudo apt-key add -
$(lsb_release -cs)):
echo "deb https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gitlab_gitlab-ce.list
echo "deb https://packages.gitlab.com/gitlab/gitlab-ee/ubuntu/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gitlab_gitlab-ee.list
sudo apt update
Omnibus安装包会自动处理依赖关系,更新步骤更简便:
# 更新软件包索引
sudo apt update
# 升级GitLab(社区版)
sudo apt upgrade gitlab-ce
# 若为企业版,将“gitlab-ce”替换为“gitlab-ee”
若通过手动下载.deb包安装,需执行以下步骤:
# 下载目标版本.deb包(以gitlab-ce为例)
wget https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/pool/main/g/gitlab-ce/gitlab-ce_<version>_amd64.deb
# 安装包并修复依赖
sudo dpkg -i gitlab-ce_<version>_amd64.deb
sudo apt-get install -f
更新完成后,需重新配置GitLab并重启服务,使更改生效:
# 重新配置GitLab(应用配置文件变更)
sudo gitlab-ctl reconfigure
# 重启GitLab服务(确保所有组件更新完成)
sudo gitlab-ctl restart
sudo gitlab-rake gitlab:env:info
sudo gitlab-ctl status
sudo gitlab-ctl tail # 实时查看GitLab日志
sudo gitlab-rake gitlab:check # 检查配置问题