Centos部署GitLab-备份恢复

1. 下载rpm包

bash 复制代码
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.8.4-ce.0.el7.x86_64.rpm

2. 安装依赖

bash 复制代码
yum -y install policycoreutils openssh-server openssh-clients postfix policycoreutils-python

3. rpm安装

bash 复制代码
rpm -ivh gitlab-ce-10.8.4-ce.0.el7.x86_64.rpm

4. 修改gitlab配置文件信息,指定服务ip和端口号

bash 复制代码
# [root@localhost ~]# vim /etc/gitlab/gitlab.rb
#末行模式执行  /external_url/

## GitLab URL
##! URL on which GitLab will be reachable.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
#external_url 'http://gitlab.example.com'
#将url修改ip和端口或者域名
external_url 'http://192.168.56.11:80'

5. 初始化配置

bash 复制代码
 gitlab-ctl reconfigure

6. 重启服务

bash 复制代码
gitlab-ctl restart

7. 直接访问

bash 复制代码
http://192.168.56.11:80

8. 备份旧环境数据

bash 复制代码
# 命令备份  备份文件路径 /var/opt/gitlab/backups/1700647561_2023_11_22_13.12.15_gitlab_backup.tar
gitlab-backup create
# 手动备份
/etc/gitlab/gitlab-secrets.json
/etc/gitlab/gitlab.rb

9. 修改新环境配置文件

修改备份数据恢复地址

修改备份数据存放地址

10. 重新加载配置文件

bash 复制代码
gitlab-ctl stop
gitlab-ctl reconfigure
gitlab-ctl start

11. 将备份数据上传恢复地址

修改备份数据恢复地址

修改备份数据存放地址

12. 停服务

bash 复制代码
停止gitlab部分服务,保证恢复过程中有数据写入
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq

13. 开始恢复

bash 复制代码
gitlab-rake gitlab:backup:restore BACKUP=1700647561_2023_11_22_13.12.15_gitlab_backup.tar
相关推荐
2501_928996222 小时前
GitLab CVE-2026-19478漏洞解析:Gitaly ref攻击绕过审计与中科热备下的代码资产保护重构
重构·gitlab
苏生Susheng2 小时前
【软件实施】Linux系统Shell脚本教程
linux·运维·服务器·chrome·spring boot·学习·实施
Ruiery2 小时前
Linux 6.6内核 IOMMU 深度解析(七):DMA API 与 IOMMU 集成 — 从 dma_map_single 到 iommu_map
linux·运维·服务器
分支预测失败2 小时前
RISC-V AIA 中断架构实战:从 PLIC 到 APLIC 与 IMSIC 的迁移
linux·后端
GeW2 小时前
RHCE学习拿证计划:锁定核心考点,实现备考效率最大化
linux
snow@li3 小时前
服务器运维:Alibaba Cloud Linux 4 LTS 64位 根目录全景深度解析文章
linux·运维·服务器
苏生Susheng3 小时前
【软件实施】Linux企业运维常用命令手册
java·linux·运维·服务器·springboot·springcloud·软件实施
额额额对了3 小时前
Linux 进程间通信(IPC)核心机制:消息队列、共享内存与信号量详解
linux·网络·网络协议
秦渝兴3 小时前
GitLab CI/CD 流水线实战
ci/cd·gitlab
zx_741484813 小时前
【Linux入门】Linux 安装:VMware Workstation Pro 安装 CentOS 7 保姆级图文教程
linux·centos