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

参考链接:开发者生态