极狐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
相关推荐
ℳ₯㎕ddzོꦿ࿐1 天前
告别手工发版:用 GitLab CI/CD 打通前后端自动化部署的“任督二脉”
ci/cd·自动化·gitlab
ℳ₯㎕ddzོꦿ࿐1 天前
实战:在 Linux 系统用 Docker-Compose 优雅部署 GitLab 及防坑指南
linux·docker·gitlab
源图客1 天前
Linux(CentOS9)服务器部署gitlab-ce-18.11.1-ce.0.el9.x86_64.rpm
linux·服务器·gitlab
ℳ₯㎕ddzོꦿ࿐1 天前
实战篇:结合 GitLab CI/CD 实现 Spring Cloud 微服务自动化部署与防坑指南
spring cloud·ci/cd·gitlab
菜萝卜子2 天前
【Git】GitLab 18.9 全局服务器钩子(Server Hooks)官方规范与落地实践
服务器·git·gitlab
lilili也3 天前
Git、VScode、GitLab
git·vscode·gitlab
郭龙_Jack4 天前
Gitlab CICD流水线设计
gitlab
MinterFusion5 天前
如果openKylin 2.0 SP2主机的IPv4地址改变,如何让GitLab正常运行
运维·gitlab·系统配置·系统维护·明德融创
Elivs.Xiang5 天前
ubuntu20中安装gitlab
linux·ubuntu·gitlab
csdn_aspnet5 天前
Gemini实战:用AI写CI/CD脚本,分享Gemini辅助编写GitLab CI、GitHub Actions等运维脚本的硬核技巧
人工智能·ci/cd·ai·gitlab·gemini·辅助编程