gitlab程式碼管理開源工具--安裝、遷移、升級
需求:現在公司使用的gitlab版本號為8.6.1,伺服器在阿里雲平臺上面,要求將原始碼從阿里雲伺服器上面遷移到本公司內部伺服器
1. 檢視gitlab版本
[[email protected] ~]# more /opt/gitlab/embedded/service/gitlab-rails/VERSION 8.6.1
2. 對gitlab進行備份
[[email protected] ~]# gitlab-rake gitlab:backup:create
會生成一個備份檔案
[[email protected] ~]# ls /var/opt/gitlab/backups/ 1541553997_gitlab_backup.tar
3. 將備份檔案拷貝下來,可以使用tftp、winscp等工具
新安裝一臺centos伺服器,保證該伺服器能夠訪問網際網路!安裝gitlab所需要的依賴包yum install curl openssh-server openssh-clients postfix cronie 關閉防火牆,以及selinux
systemctl stop firewalld systemctl disable firewalld setenforce 0 sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config 新增清華大學的yum源cat > /etc/yum.repos.d/gitlab-ce.repo << EOF
安裝、配置gitlab
yum -y install gitlab-ce-8.6.1
##修改URL,指定本地IP
vim /etc/gitlab/gitlab.rb
external_url 'http://192.168.1.24'
##初始化
gitlab-ctl reconfigure
遷移gitlab進行恢復操作
gitlab-ctl stop sidekiq
gitlab-ctl stop unicorn
將備份檔案傳備份目錄下:
ls /var/opt/gitlab/backups/
更改使用者組以及許可權
chown git /var/opt/gitlab/backups/* -R ;chown 777 -R /var/opt/gitlab/backups/*
開始還原,BACKUP的編號要一致
gitlab-rake gitlab:backup:restore BACKUP=1541553997
會出現兩次互動式介面,都需要輸入yes
升級gitlab
(注意:由於升級不能跨越大版本號,因此只能升級到當前大版本號到最高版本,方可升級到下一個大版本號,一定保證資料可以正常訪問方可執行下一步升級指令)
yum -y install gitlab-ce-8.17.8
gitlab-ctl reconfigure yum -y install gitlab-ce-9.5.9
gitlab-ctl reconfigure yum -y install gitlab-ce-10.8.0
gitlab-ctl reconfigure yum -y install gitlab-ce-11.3.0
gitlab-ctl reconfigure