centos7.5搭建gitlab&&gitlab備份遷移恢復

gitlab安裝

1、yum -y install policycoreutils openssh-server openssh-clients postfix 

2、systemctl enable postfix && systemctl start postfix

3、鏡像地址可以自己選擇

      wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
 
     yum install policycoreutils-python
 
    rpm -ivh gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm

4、vim /etc/gitlab/gitlab.rb
 
     external_url http://IP:端口    //修改訪問地址
 5、執行配置  

      gitlab-ctl reconfigure

6、啓動

      gitlab-ctl start   #啓動
 
      gitlab-ctl restart  #重啓

7、設置開機自啓

      //開機自啓
       systemctl enable gitlab-runsvdir.service
     //取消開機自啓
       systemctl disable gitlab-runsvdir.service 

Gitlab備份、遷移、恢復和升級

1、備份git服務器數據

      gitlab-rake gitlab:backup:create RAILS_ENV=production 

      注:默認備份後文件一般位於/var/opt/gitlab/backups/,文件名字:

2、新服務器上安裝與原服務器一樣版本的gitlab。

    查看版本信息

    cat /opt/gitlab/embedded/service/gitlab-rails/VERSION 

3、將生成的tar文件拷貝到新服務器對應的backups目錄下

4、新GitLab服務數據恢復

    [root@gitlab ~]# gitlab-ctl stop unicorn        #停止相關數據連接服務

    [root@gitlab ~]# gitlab-ctl stop sidekiq

    [root@gitlab-new ~]# chmod 777 /var/opt/gitlab/backups/1530156812_2018_06_28_10.8.4_gitlab_backup.tar

     #修改權限,如果是從本服務器恢復可以不修改

    [root@gitlab ~]# gitlab-rake gitlab:backup:restore RAILS_ENV=production   BACKUP=1530156812_2018_06_28_10.8.4

     #從1530156812_2018_06_28_10.8.4編號備份中恢復

      按照提示輸入兩次yes並回車

5、 [root@gitlab ~]# gitlab-ctl start                #啓動gitlab

        瀏覽器訪問新服務器的地址進行查看,遷移成功

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章