Gitlab安裝與備份恢復

1、安裝和配置必要的依賴項
在CentOS 7上,在系統防火牆中打開HTTP,HTTPS和SSH訪問。


sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld

二、安裝Postfix以發送通知電子郵件

sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
用rpm命令安裝
rpm -ivh gitlab-ce-12.3.0-ce.0.el7.x86_64.rpm

三、相應目錄:

  /var/log/gitlab       --日誌目錄
  /etc/gitlab             --配置文件目錄
  /opt/gitlab/init/
  /opt/gitlab/etc/

四、GITLAB備份配置修改:
編輯gitlab.rb

gitlab_rails['manage_backup_path']=true
gitlab_rails['backup_path']="你的備份目錄" //gitlab備份目錄
gitlab_rails['backup_archive_permissions']=0644 //生成的備份文件權限
gitlab_rails['backup_keep_time'] = 7776000 //備份保留天數,秒計算

五、GITLAB生成備份腳本auto_backup.sh:

gitlab-rake gitlab:backup:create CRON=1

六、Gitlab定時備份

定時任務:sudo crontab -e
1.腳本任務:41 12 * * * /var/opt/gitlab/backups/auto_backup.sh -D 1
2.命令:45 12 * * * gitlab-rake gitlab:backup:create

查看定時任務:contab -l
修改後重啓cron:/etc/init.d/crond restart

七、Gitlab恢復
把備份文件拷貝到/var/opt/gitlab/backups目錄
sudo gitlab-rake gitlab:backup:restore BACKUP=1577383292_2019_12_27_12.3.0

參考鏈接:開發者生態

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