gitlab【安装部署、备份与恢复】

【1】安装依赖

[root@git ~]# yum -y install install curl opessh-server postfix wget

【2】安装软件包

[root@git ~]# yum -y localinstall gitlab-ce-11.2.3-ce.0.el7.x86_64.rpm

【3】修改配置

[root@git ~]# grep "^[a-Z]" /etc/gitlab/gitlab.rb 
external_url 'http://gitlab.test.com'
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = '********@qq.com'
gitlab_rails['gitlab_email_display_name'] = 'test-senders'
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "********@qq.com"
gitlab_rails['smtp_password'] = "**************"
gitlab_rails['smtp_domain'] = "qq.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
prometheus['enable'] = false
prometheus['monitor_kubernetes'] = false
alertmanager['enable'] = false
node_exporter['enable'] = false
redis_exporter['enable'] = false
postgres_exporter['enable'] = false
gitlab_monitor['enable'] = false
prometheus_monitoring['enable'] = false

【4】初始化gitlab、后续修改了配置也需要初始化

[root@git ~]# gitlab-ctl reconfigure

Running handlers:
Running handlers complete
Chef Client finished, 321/467 resources updated in 01 minutes 37 seconds
gitlab Reconfigured!

【5】查看安装是否报错

[root@git ~]# gitlab-ctl status
run: gitaly: (pid 19674) 275s; run: log: (pid 19700) 274s
run: gitlab-workhorse: (pid 19660) 276s; run: log: (pid 19697) 274s
run: logrotate: (pid 19439) 316s; run: log: (pid 19667) 275s
run: nginx: (pid 19419) 322s; run: log: (pid 19698) 274s
run: postgresql: (pid 19144) 362s; run: log: (pid 19651) 276s
run: redis: (pid 19084) 368s; run: log: (pid 19650) 276s
run: sidekiq: (pid 19386) 330s; run: log: (pid 19653) 276s
run: unicorn: (pid 19348) 336s; run: log: (pid 19652) 276s

【6】验证邮箱是否正常

[root@git ~]# gitlab-rails console
-------------------------------------------------------------------------------------
 GitLab:       11.2.3 (06cbee3)
 GitLab Shell: 8.1.1
 postgresql:   9.6.8
-------------------------------------------------------------------------------------
Loading production environment (Rails 4.2.10)
irb(main):001:0> Notify.test_email('********@qq.com','test','测试').deliver_now

gitlab【安装部署、备份与恢复】_第1张图片

 【7】浏览器测试访问

gitlab【安装部署、备份与恢复】_第2张图片

gitlab【安装部署、备份与恢复】_第3张图片 

【8】汉化、需要软件包,版本一致

tar xf gitlab-11-2-stable-zh.tar.gz 
cp -r /opt/gitlab/embedded/service/gitlab-rails{,.bak}
/bin/cp -r gitlab-11-2-stable-zh/* /opt/gitlab/embedded/service/gitlab-rails/
### 重新配置 ###
gitlab-ctl reconfigure
gitlab-ctl restart

gitlab【安装部署、备份与恢复】_第4张图片

 【9】数据备份

gitlab【安装部署、备份与恢复】_第5张图片

[root@git test]# vim /etc/gitlab/gitlab.rb
.....
298 gitlab_rails['manage_backup_path'] = true
299 gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"
307 gitlab_rails['backup_keep_time'] = 604800
.....

### 重新加载 ###
[root@git test]# gitlab-ctl reconfigure
### 执行备份命令 ###
[root@git test]# gitlab-rake gitlab:backup:create

[root@git test]# crontab -l
00 02 * * * /usr/bin/gitlab-rake gitlab:backup:create

[root@git test]# ls /var/opt/gitlab/backups/
1688544691_2023_07_05_11.2.3_gitlab_backup.tar

【10】数据恢复

### 停止数据写入服务 ###
[root@git test]# gitlab-ctl stop unicorn
ok: down: unicorn: 0s, normally up
[root@git test]# gitlab-ctl stop sidekiq
ok: down: sidekiq: 0s, normally up

### 使用gitlab-rake恢复,指定备份的名称tar包【不需要_gitlab_backup.tar结尾】 ###
[root@git test]# gitlab-rake gialab:backup:restore BACKUP=1688544691_2023_07_05_11.2.3

### 重启gitlab,检测是否恢复 ###
[root@git test]# gitlab-ctl restart

### 查看日志,是否含有报错 ###
[root@git test]# gitlab-ctl tail

 

你可能感兴趣的:(gitlab,gitlab,linux,运维)