ubuntu14.04升級以及gitlab升級
阿新 • • 發佈:2017-08-19
gitlab
環境:系統版本ubuntu14.04 、gitlab-ce.8.11.3
升級要求:系統升級為目前最新的LTS版本的ubuntu16.04、gitlab升級為最新的版本
升級可以有兩種方案:
一種類似於遷移(重新找臺機器,系統直接安裝ubuntu16.04,然後安裝gitlab版本和原版本一致,進行數據遷移後確認數據無誤後再對gitlab進行升級)。
另一種直接在原機器上,首先對系統升級,然後對gitlab升級。
1、直接在原機器上升級的方案:
升級前備份數據:
停止gitlab備份數據 gitlab-ctl stop unicorn gitlab-ctl stop sidekiq gitlab-ctl stop nginx gitlab-rake gitlab:backup:create ls /var/opt/gitlab/backups/ 到阿裏雲中對gitlab機器創建快照,並把備份的gitlab數據拷貝出來
ubuntu14.04升級:
gitlab-ctl stop 更換apt源後更新(將apt源替換為16.04的xenial版本) apt-get -y update apt-get -y upgrade apt-get -y dist-upgrade
系統更新後啟動gitlab,開始進行gitlab的更新
gitlab-ctl restart gitlab-ctl stop unicorn gitlab-ctl stop sidekiq gitlab-ctl stop nginx
更新gitlab的兩種方法:
1、使用dpkg安裝包的方法 把下載好的gitlab_9.4.3版本傳到gitlab服務器上使用dpkg進行安裝 dpkg -i gitlab-ce_9.4.3-ce.0_amd64.deb gitlab-ctl restart 2、使用apt-get的方法 curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash apt-get update apt list|grep gitlab apt install -y gitlab-ce gitlab-ctl restart
2、類似於遷移的方案:
遷移前備份數據:
停止gitlab備份數據 gitlab-ctl stop unicorn gitlab-ctl stop sidekiq gitlab-ctl stop nginx gitlab-rake gitlab:backup:create ls /var/opt/gitlab/backups/ 到阿裏雲中對gitlab機器創建快照,並把備份的gitlab拷貝到新機器上
ubuntu16.04安裝好gitlab後進行恢復數據(此時安裝的gitlab版本和原機器上的gitlab版本一致):
gitlab-ctl stop unicorn gitlab-ctl stop sidekiq gitlab-ctl stop nginx ll /var/opt/gitlab/backups/ chown git:git /var/opt/gitlab/backups/1502516978_gitlab_backup.tar ll /var/opt/gitlab/backups/1502516978_gitlab_backup.tar gitlab-rake gitlab:backup:restore BACKUP=1502516978 數據恢復後,gitlab數據倉庫目錄權限會發生變化,如果不更改,在後面升級gitlab時會出錯 ls -ld /var/opt/gitlab/git-data/repositories chmod 2770 /var/opt/gitlab/git-data/repositories gitlab-ctl restart
確保數據無誤後,開始升級gitlab,升級前先停止gitlab的一些服務:
gitlab-ctl stop unicorn gitlab-ctl stop sidekiq gitlab-ctl stop nginx
更新gitlab的兩種方法:
1、使用dpkg安裝包的方法 把下載好的gitlab_9.4.3版本傳到gitlab服務器上使用dpkg進行安裝 dpkg -i gitlab-ce_9.4.3-ce.0_amd64.deb gitlab-ctl restart 2、使用apt-get的方法 curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash apt-get update apt list|grep gitlab apt install -y gitlab-ce gitlab-ctl restart
說明:升級時之所以沒有停止數據庫服務,是因為當gitlab進行升級前,軟件會自動備份數據庫中的數據,並對數據庫進行一些操作。
參考:https://docs.gitlab.com/omnibus/README.html
本文出自 “甘木” 博客,請務必保留此出處http://ganmu.blog.51cto.com/9305511/1957416
ubuntu14.04升級以及gitlab升級