Help us learn about your current experience with the documentation. Take the survey.
使用补丁版本更新自编译安装
- Tier: Free, Premium, Ultimate
- Offering: GitLab Self-Managed
使用补丁版本更新自编译安装。
前置条件:
- 自编译安装的 备份。
停止 GitLab 服务器
要停止 GitLab 服务器:
# 对于运行 systemd 的系统
sudo systemctl stop gitlab.target
# 对于运行 SysV init 的系统
sudo service gitlab stop获取稳定分支的最新代码
在以下命令中,将 LATEST_TAG 替换为要更新的 GitLab 标签。例如,v8.0.3。
-
检查当前版本:
cat VERSION -
获取所有可用标签的列表:
git tag -l 'v*.[0-9]' --sort='v:refname' -
为您当前的主版本和次版本选择一个补丁版本。
-
检出要使用的补丁版本的代码:
cd /home/git/gitlab sudo -u git -H git fetch --all sudo -u git -H git checkout -- Gemfile.lock db/structure.sql locale sudo -u git -H git checkout LATEST_TAG -b LATEST_TAG
安装库并运行迁移
要安装库并运行迁移,请运行以下命令:
cd /home/git/gitlab
# 如果您在安装或之前的升级中尚未这样做
sudo -u git -H bundle config set --local deployment 'true'
sudo -u git -H bundle config set --local without 'development test kerberos'
# 更新 gems
sudo -u git -H bundle install
# 可选:清理旧的 gems
sudo -u git -H bundle clean
# 运行数据库迁移
sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
# 清理资源和缓存
sudo -u git -H bundle exec rake yarn:install gitlab:assets:clean gitlab:assets:compile cache:clear RAILS_ENV=production NODE_ENV=production NODE_OPTIONS="--max_old_space_size=4096"将 GitLab Workhorse 更新到新的补丁版本
要将 GitLab Workhorse 更新到新的补丁版本,请运行以下命令:
cd /home/git/gitlab
sudo -u git -H bundle exec rake "gitlab:workhorse:install[/home/git/gitlab-workhorse]" RAILS_ENV=production将 Gitaly 更新到新的补丁版本
要将 Gitaly 更新到新的补丁版本,请运行以下命令:
cd /home/git/gitlab
sudo -u git -H bundle exec rake "gitlab:gitaly:install[/home/git/gitaly,/home/git/repositories]" RAILS_ENV=production将 GitLab Shell 更新到新的补丁版本
要将 GitLab Shell 更新到新的补丁版本,请运行以下命令:
cd /home/git/gitlab-shell
sudo -u git -H git fetch --all --tags
sudo -u git -H git checkout v$(</home/git/gitlab/GITLAB_SHELL_VERSION) -b v$(</home/git/gitlab/GITLAB_SHELL_VERSION)
sudo -u git -H make build将 GitLab Pages 更新到新的补丁版本(如果需要)
如果您正在使用 GitLab Pages,请将其更新到新的补丁版本:
cd /home/git/gitlab-pages
sudo -u git -H git fetch --all --tags
sudo -u git -H git checkout v$(</home/git/gitlab/GITLAB_PAGES_VERSION)
sudo -u git -H make安装或更新 gitlab-elasticsearch-indexer
- Tier: Premium, Ultimate
- Offering: GitLab Self-Managed
要安装或更新 gitlab-elasticsearch-indexer,请按照
安装说明 操作。
启动 GitLab
要启动 GitLab,请运行以下命令:
# 对于运行 systemd 的系统
sudo systemctl start gitlab.target
sudo systemctl restart nginx.service
# 对于运行 SysV init 的系统
sudo service gitlab start
sudo service nginx restart检查 GitLab 及其环境
要检查 GitLab 及其环境是否配置正确,请运行:
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production为确保没有遗漏任何内容,请运行更全面的检查:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production如果所有项目都是绿色状态,那么恭喜您,升级完成!
确保后台迁移已完成
检查后台迁移的状态 并确保它们已完成。