centos7.5搭建gitlab&&gitlab备份迁移恢复

Bertha 。 2023-07-16 07:57 83阅读 0赞

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

浏览器访问新服务器的地址进行查看,迁移成功

发表评论

表情:
评论列表 (有 0 条评论,83人围观)

还没有评论,来说两句吧...

相关阅读