更新 GitLab
我們用的是 GitLab Omnibus 7.10.5 版本,查到Doc(6.x.x 等低版本區別對待,詳見文檔)。
按照文檔:
# To update to a newer GitLab version, all you have to do is:
# Debian/Ubuntu
sudo apt-get update
sudo apt-get install gitlab-ce
# Centos/RHEL
sudo yum install gitlab-ce
看起來太簡單了!事實上,也就是這么簡單。
但是,問題來了,sudo apt-get install gilab-ce
默認所用的源是 packages-gitlab-com.s3.amazonaws.com,然后你懂的,被牆了!
解決辦法有兩個:
- 給 apt 加代理;
- 換源。
1). 給 apt 加代理
考慮到換源可能產生其他的依賴問題,先嘗試 加代理。結果是加了代理還是不行!原因可能是代理連接速度問題,總是超時。
這里參考的是 打造Linux 終端翻牆環境 使用 shadowsocks + privoxy
。
2). 換源解決!
Docs 里已經有聲明其實:
- 首先,添加信任 GitLab 里的 GPG 公鑰:
curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add - &>/dev/null
- 然后把
/etc/apt/sources.list.d/gitlab_gitlab-ce.list
文件中默認的源換成 deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu trusty main
- 最后:
sudo update
sudo apt-get install gitlab-ce
安裝完成!
對於更新版本跨度較大的情況
1). 關閉部分gitlab服務
升級之前,我們首先要關閉gitlab部分服務,如下:
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-ctl stop nginx
2). 選擇要升級的版本
然后執行命令:
apt-get install gitlab-ce=11.0.3-ce.0
其中11.0.3
替換為你要升級的版本號。
ps:版本跨度過大,請務必一個小版本一個小版本的更新
另外,附上一次成功的更新過程對應的版本號:
9.2.5-->9.5.6-->10.0.6-->10.8.5-->11.0.3
3). 重啟gitlab
gitlab-ctl reconfigure
gitlab-ctl restart
References:
- http://www.a-ho.com/2016/01/16/打造Linux-終端翻牆環境/
- https://about.gitlab.com/downloads/#ubuntu1404
- https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/
- http://docs.gitlab.com/omnibus/update/README.html
- https://about.gitlab.com/upgrade-to-package-repository/
- https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/trusty/gitlab-ce_8.9.5-ce.0_amd64.deb
- https://www.ilanni.com/?p=13917
- https://www.58jb.com/html/189.html