极狐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
相关推荐
菜鸡00011 天前
把一个项目传到 GitLab 的某个群组
大数据·elasticsearch·gitlab
AlbertS2 天前
记一次推送lfs失败不能迁移git仓库到新的gitlab的问题
git·ai·gitlab·lfs·rejected
日更嵌入式的打工仔2 天前
Windows 下 GitLab 完整使用指南
windows·gitlab
会飞的大可2 天前
Jenkins vs GitLab CI/CD:2026 企业级 CI/CD 工具深度选型评测
ci/cd·gitlab·jenkins
庭風3 天前
让 AI 从需求直接走到 MR:我开源了一个面向 GitLab 的工作流 MCP
gitlab
Sakuyu434683 天前
Git-GitLab-JenKins
git·gitlab·jenkins
Aaron_dw3 天前
基于 Jenkins + GitLab + 自动化测试的 CI/CD 自动化系统方案(IaC + 弹性构建节点)
ci/cd·gitlab·jenkins
虎头金猫3 天前
自建 GitLab 没公网?用内网穿透技术,远程开发协作超丝滑
运维·服务器·网络·开源·gitlab·开源软件·开源协议
MinterFusion5 天前
如何在openKylin下安装并配置GitLab(v0.1.1)
gitlab·系统维护·devops工具·麒麟操作系统·明德融创·openkylin
我就是你毛毛哥6 天前
Docker 安装 GitLab
docker·容器·gitlab