Centos gitlab简单搭建备份及恢复

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos gitlab简单搭建备份及恢复相关的知识,希望对你有一定的参考价值。

1.安装配置必须的依赖

yum install curl policycoreutils openssh-server openssh-clients

systemctl enable sshd

systemctl start sshd

yum install postfix

systemctl enable postfix

systemctl start postfix

firewall-cmd --permanent --add-service=http

systemctl reload firewalld

2.安装gitlab

rpm -ivh gitlab-ce-8.11.6-ce.0.el6.x86_64.rpm

3.配置并启动gitlab

gitlab-ctl reconfigure

4.默认账户密码

Username: root

Password: 5iveL!fe

5.备份

gitlab-rake gitlab:backup:create

默然的备份目录为: /var/opt/gitlab/backups 


修改备份目录


vi /etc/gitlab/gitlab.rb

gitlab_rails['backup_path'] = '/mnt/gitlab_backups'


6.数据恢复和还原

     

  停止服务

gitlab-ctl stop unicorn

gitlab-ctl stop sidekiq


BACKUP后面跟的是备份文件的时间戳,比如恢复备份文件1458217074_gitlab_backup.tar,注:需要恢复的文件必须放在gitlib的备份目录下

gitlab-rake gitlab:backup:restore BACKUP=1458213020


恢复完成启动服务


gitlab-ctl start/restart


以上gitlab基本搭建完成 网页直接IP访问 默认端口为80 

#修改默认端口

1.Change port to 81 (You can choose your own) at port: near by production:$base >> gitlab: for file /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml


2.Change your host address if you like to use different from your ip address or localhost


3.Change server port to 81 in file "/opt/gitlab/embedded/conf/nginx.conf"


4.Restart gitlab using command "sudo gitlab-ctl restart".


5.Open "/etc/gitlab/gitlab.rb" to text editor where currently I have external_url 'http://myipaddress/' as text. I just change to

external_url 'http://gitlab.com.local:81/'

then reconfigure using command "sudo gitlab-ctl reconfigure" and voila, Gitlab is now working on port 81.


#开机自启动

systemctl enable gitlab-runsvdir.service

systemctl start gitlab-runsvdir.service

gitlab-cmd start


以上是关于Centos gitlab简单搭建备份及恢复的主要内容,如果未能解决你的问题,请参考以下文章

Gitlab 运维篇之——备份及恢复

gitlab 搭建 备份 升级 迁移恢复

GitLab多机备份与恢复操作

Gitlab备份恢复与迁移

Gitlab备份与恢复迁移与升级

Git--07 Gitlab备份与恢复