Ubuntu上GitLab更新指南(适用于Omnibus安装)
sudo gitlab-rake gitlab:backup:create/var/opt/gitlab/backups目录。sudo gitlab-rake gitlab:env:infosudo gitlab-ctl status。sudo apt update && sudo apt upgrade -y && sudo reboot。若未添加GitLab官方仓库,需通过以下命令添加(以社区版为例):
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
此命令会自动添加GitLab的GPG密钥和软件源,确保后续可从官方渠道获取更新。
sudo apt update。apt命令升级GitLab社区版(若为企业版,将gitlab-ce替换为gitlab-ee):sudo apt upgrade gitlab-cesudo gitlab-ctl reconfigure(重新生成配置文件)sudo gitlab-ctl restart(重启GitLab相关服务,如nginx、postgresql、gitlab-workhorse)。sudo gitlab-rake gitlab:env:infohttp://your-domain.com),在首页底部查看版本号。若通过Docker运行GitLab,需执行以下操作:
docker pull gitlab/gitlab-ce:latest(社区版)docker stop gitlab && docker rm gitlabdocker run --detach --hostname your-hostname --publish 443:443 --publish 80:80 --publish 22:22 --name gitlab --restart always --volume /srv/gitlab/config:/etc/gitlab --volume /srv/gitlab/logs:/var/log/gitlab --volume /srv/gitlab/data:/var/opt/gitlab gitlab/gitlab-ce:latest