极狐gitlab 安装、迁移、升级

一、环境介绍

原系统版本:centos 7

原gitlab版本: 17.7.7-jh

新系统版本:Anolis OS23.4GA

升级后gitlab版本:18.9.1-jh

二、原系统备份

1、备份gitlab

bash 复制代码
 gitlab-backup create

备份文件目录

bash 复制代码
/var/opt/gitlab/backups/

2、备份配置文件

bash 复制代码
cp /etc/gitlab/gitlab.rb /root/gitlab.rb.bak
cp /etc/gitlab/gitlab-secrets.json /root/gitlab-secrets.json.bak

三、在新服务器上安装"同版本"GitLab

软件列表:
https://packages.gitlab.cn/#browse/browse

下载:

bash 复制代码
wget https://packages.gitlab.cn/repository/el/9/gitlab-jh-17.7.7-jh.0.el9.x86_64.rpm

安装:

bash 复制代码
EXTERNAL_URL="http://your-gitlab-domain.com" dnf localinstall gitlab-jh-17.7.7-jh.0.el9.x86_64.rpm

四、迁移恢复

1、复制备份

bash 复制代码
scp /var/opt/gitlab/backups/1772593077_2026_03_04_17.7.7-jh_gitlab_backup.tar root@10.99.50.140:/var/opt/gitlab/backups/1772593077_gitlab_backup.tar
scp /root/gitlab.rb.bak root@10.99.50.140:/etc/gitlab/gitlab.rb
scp /root/gitlab-secrets.json.bak root@10.99.50.140:/etc/gitlab/gitlab-secrets.json

2、停止数据写入

bash 复制代码
gitlab-ctl stop sidekiq
gitlab-ctl stop puma

3、恢复备份

bash 复制代码
# 执行恢复命令 (只填时间戳!)
gitlab-backup restore BACKUP=1772593077

4、重新配置和启动

bash 复制代码
gitlab-ctl reconfigure 
gitlab-ctl restart

五、升级

1、确定升级路线

https://gitlab-com.gitlab.io/support/toolbox/upgrade-path/

安装此版本顺序依次升级

2、下载软件包依次升级

https://packages.gitlab.cn/#browse/browse

bash 复制代码
wget https://packages.gitlab.cn/repository/el/9/gitlab-jh-17.8.7-jh.0.el9.x86_64.rpm

升级:

bash 复制代码
dnf localinstall gitlab-jh-17.8.7-jh.0.el9.x86_64.rpm

3、重新配置和启动

bash 复制代码
gitlab-ctl reconfigure 
gitlab-ctl restart

六、CI runner 部署(可选)

1、安装

bash 复制代码
# Download the binary for your system
sudo curl -L --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.gitlab.cn/latest/binaries/gitlab-runner-linux-amd64

# Give it permission to execute
sudo chmod +x /usr/local/bin/gitlab-runner

# Create a GitLab Runner user
sudo useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash

# Install and run as a service
sudo gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
sudo gitlab-runner start

2、注册


运行注册

bash 复制代码
gitlab-runner register  --url http://xxx.com  --token glrt-lMVZAlo2wRB-aZKXN-Vi3m86MQp0OjEKdToxCw.01.1211tvl50
相关推荐
七夜zippoe3 小时前
Java项目CI/CD实战:Jenkins与GitLab CI深度解析
java·ci/cd·gitlab·jenkins·groovy·pipline
Aliex_git14 天前
Dockerfile 优化实践笔记
笔记·学习·gitlab
成为你的宁宁14 天前
Jenkins 自动化部署前后端分离若依项目全攻略:涵盖环境配置、Maven/Node.js 工具安装、GitLab 项目协同,及前后端构建、服务器推送与代码更新验证全步骤
node.js·自动化·gitlab·jenkins·maven
sunshinebo15 天前
一次 GitLab 无法启动的排查:Docker 日志把 500G 磁盘打满
docker·eureka·gitlab
何以不说话15 天前
DevOps、Git 和 GitLab
git·gitlab·devops
ZAEQgyKFs17 天前
永磁同步电机模型预测电流控制+滑模控制 [1]速度环采用滑模控制 滑模控制器采用新型趋近律与扰...
gitlab
马克Markorg18 天前
使用 Docker Compose 本地部署 GitLab 教程
docker·容器·gitlab
大尚来也21 天前
CI/CD 流水线搭建实战:GitHub Actions vs GitLab CI 2026 深度对比与选型指南
ci/cd·gitlab·github
ProgramHan21 天前
github、gitlab、gitee分别都是什么,为什么不能访问?
gitee·gitlab·github