當前版本
當前GitLab版本由寶塔自動安裝的8.8.5,但截止至2018-06-12,CentOS的GitLab官方最新版本為10.8.4,顯然版本相差較大,故打算跨版本升級至最新版

步驟
升級指南
GitLab社群版不支援直接跨版本升級,需按照官方指南一步步向上升級,若版本越舊,需要跨的版本就越多

下載相關安裝包
安裝包國內選擇清華映象站速度較快,教育網還有蜜汁加成

若升級其他版本也可自行Ctrl+F

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-8.17.7-ce.0.el7.x86_64.rpm
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.5.8-ce.0.el7.x86_64.rpm
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.1.4-ce.0.el7.x86_64.rpm
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.8.4-ce.0.el7.x86_64.rpm
複製程式碼

升級
關閉GitLab核心服務
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-ctl stop nginx
複製程式碼

安裝8.17.7
rpm -Uvh gitlab-ce-8.17.7-ce.0.el7.x86_64.rpm
複製程式碼

重啟服務
若之前從寶塔安裝後未配置GitLab的Nginx啟動命令則需要自行配置後才能正常啟動,操作見文章GitLab修改配置後nginx無法啟動 重啟服務
[root@localhost ~]# gitlab-ctl restart
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/omnibus-ctl-0.3.6/lib/omnibus-ctl.rb:533: warning: Insecure world writable dir /www/server/nvm/versions/node/v8.11.2/bin in PATH, mode 040777
ok: run: gitlab-workhorse: (pid 39809) 1s
ok: run: logrotate: (pid 39821) 0s
ok: run: nginx: (pid 39828) 0s
ok: run: postgresql: (pid 39835) 0s
ok: run: redis: (pid 39844) 0s
ok: run: sidekiq: (pid 39849) 1s
ok: run: unicorn: (pid 39854) 0s
複製程式碼
重啟後稍等片刻即可訪問,檢視版本號,已經更新為8.17.7,後續步驟同上

可能的報錯
部分CentOS版本較低未自帶policycoreutils-python
元件可能無法升級至10.x,需要手動
yum -y install policycoreutils-python
複製程式碼
完成

更新到10.x後明顯啟動項都變多了
[root@localhost ~]# gitlab-ctl restart
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/omnibus-ctl-0.5.0/lib/omnibus-ctl.rb:684: warning: Insecure world writable dir /www/server/nvm/versions/node/v8.11.2/bin in PATH, mode 040777
ok: run: alertmanager: (pid 45330) 1s
ok: run: gitaly: (pid 45336) 0s
ok: run: gitlab-monitor: (pid 45346) 1s
ok: run: gitlab-workhorse: (pid 45362) 0s
ok: run: logrotate: (pid 45369) 1s
ok: run: nginx: (pid 45378) 0s
ok: run: node-exporter: (pid 45383) 0s
ok: run: postgres-exporter: (pid 45387) 1s
ok: run: postgresql: (pid 45394) 0s
ok: run: prometheus: (pid 45476) 1s
ok: run: redis: (pid 45484) 0s
ok: run: redis-exporter: (pid 45488) 1s
ok: run: sidekiq: (pid 45493) 0s
ok: run: unicorn: (pid 45503) 1s
複製程式碼
檢視版本號,成功
