1. 程式人生 > >centos 7.4 部署並升級gitlab

centos 7.4 部署並升級gitlab

pre 4.3 一個 top 服務器安裝 恢復 update 們的 步驟

事由:

老git服務器centos 7.2上的git版本是8.13.5,先特在一臺測試機centos 7.4上安裝git 8.13.5 後,還原git後,在對測試服務器上git進行升級操作。

測試服務器git升級沒有問題後,在對正式git進行升級。

升級版本步驟 8.13.5-》8.17.8(8中最大的版本)-》9.5.9(9中最大的版本)-》10.8.7(10中最大版本)暫時不升級11版本。

1、測試服務器安裝git

安裝gitlab-ce-8.13.5-ce.0.el7.x86_64
#curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh |bash
#yum install gitlab-ce-8.13.5-ce.0.el7.x86_64

2、備份老的git

備份數據
#/opt/gitlab/bin/gitlab-rake gitlab:backup:create
執行後在/var/opt/gitlab/backups目錄創建一個名稱類似為1502357536_2019_01_10__gitlab_backup.tar的壓縮包
備份配置文件
#/etc/gitlab/gitlab.rb 配置文件須備份
#/var/opt/gitlab/nginx/conf nginx配置文件

3、還原git數據和配置文件

將測試服務器gitlab和nginx配置文件備份

1、將備份文件權限修改為777
第一步,將備份文件權限修改為777,不然可能恢復的時候會出現權限不夠,不能解壓的問題
chmod 777 1502357536_2017_08_10_9.4.3_gitlab_backup.tar 
2、執行命令停止相關數據連接服務
第二步,執行命令停止相關數據連接服務
# 停止相關數據連接服務
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
3、執行命令從備份文件中恢復Gitlab
第三步,執行命令從備份文件中恢復Gitlab
gitlab-rake gitlab:backup:restore BACKUP=備份文件編號
例如我們的備份文件的編號是1502357536_2017_08_10_9.4.3,因此執行下面的命令即可恢復gitlab
gitlab-rake gitlab:backup:restore BACKUP=1502357536_2017_08_10_9.4.3
出現交互頁面,輸入yes回車。
4、恢復完成後,啟動gitlab
gitlab-ctl reconfigure
gitlab-ctl start

4、 升級到gitlab-ce-8.17.8-ce.0.el7.x86_64

#curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash
#yum update gitlab-ce-8.17.8-ce.0.el7.x86_64

gitlab-ctl reconfigure  中有項目目錄報錯同時頁面502錯誤,需要執行下面的chmod
chmod 2770 /home/data/git/git-data/repositories

gitlab-ctl reconfigure
gitlab-ctl  start

登錄頁面查看版本是否正確

  

5、升級到gitlab-ce-9.5.9-ce.0.el7.x86_64  

#curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash
#yum update gitlab-ce-9.5.9-ce.0.el7.x86_64
#gitlab-ctl reconfiugre
#gitlab-ctl start
登錄頁面查看版本是否正確

6、升級到gitlab-ce-10.8.7-ce.0.el7.x86_64

#curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash
#yum update gitlab-ce-10.8.7-ce.0.el7.x86_64
#gitlab-ctl reconfiugre
#gitlab-ctl start
登錄頁面查看版本是否正確

  

centos 7.4 部署並升級gitlab