在Ubuntu系统中更新GitLab,您可以选择使用官方推荐的包管理器(APT)或者Docker。以下是详细的更新步骤:
添加GitLab官方GPG密钥和软件源:
curl https://packages.gitlab.com/gpg.key | sudo apt-key add -
sudo sh -c 'echo "deb https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/gitlab.list'
更新系统软件包列表:
sudo apt-get update
检查可用的GitLab版本:
apt-cache madison gitlab-ce
升级GitLab:
sudo apt-get install gitlab-ce=<new-version>
将 <new-version>
替换为您要安装的GitLab版本号。
重启GitLab服务:
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
拉取最新的GitLab镜像:
docker pull gitlab/gitlab-ce:latest
停止并删除当前的GitLab容器:
docker stop gitlab
docker rm gitlab
使用最新的镜像重新创建并启动GitLab容器:
docker 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
将 <your-hostname>
替换为您的GitLab主机名。