centos7下gitlab的搭建、备份与还原

1、gitlab的搭建

  • 安装基础包
yum -y install curl policycoreutils openssh-server openssh-clients
  • 启动sshd
 systemctl enable sshd
 systemctl start sshd
  • 安装postfix
yum -y install postfix
systemctl enable postfix
systemctl start postfix
  • 添加防火墙规则
firewall-cmd --permanent --add-service=http
systemctl reload firewalld
  • 下载并安装软件包(软件包下载较慢)
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
yum install gitlab-ce

默认安装的是最新的gitlab-ce的包,如果需要特定的版本可以在官网去下载特定的版本
地址:

https://packages.gitlab.com/gitlab/gitlab-ce/
  • 配置并启动gitlab
 gitlab-ctl reconfigure
  • 默认账户密码是
Username: root 
Password: 5iveL!fe

2、 gitlab的备份

  • 备份命令
gitlab-rake gitlab:backup:create

默然的备份目录为: /var/opt/gitlab/backups
备份文件名类似: 1393513186_gitlab_backup.tar

  • 备份目录的修改
vi /etc/gitlab/gitlab.rb
gitlab_rails['backup_path'] = '/mnt/gitlab_backups'

3、gitlab数据的恢复或还原

提示:gitlab数据的恢复或者迁移成功的前提——两台服务器的gitlab的版本必须相同,若不相同则可能迁移或者恢复失败

  • 将备份文件放在gitlab的默认备份目录

比如/var/opt/gitlab/backups下的1458217074_gitlab_backup.tar

  • 设置自动备份
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create 
  • 恢复或者还原

停服务

 gitlab-ctl stop unicorn
 gitlab-ctl stop sidekiq

恢复数据

gitlab-rake gitlab:backup:restore BACKUP=1458213020

BACKUP后面跟的是备份文件的时间戳,比如恢复备份文件1458217074_gitlab_backup.tar

gitlab-rake gitlab:backup:restore BACKUP=1458217074
  • 回复完启动服务
 gitlab-ctl start
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值