极狐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
相关推荐
lisanmengmeng2 天前
gitlab 免密配置
linux·服务器·gitlab
求知若渴,虚心若愚。2 天前
Jenkins 自动化流水线(CICD)
运维·自动化·gitlab
mnasd4 天前
Gitlab + Jenkins 实现 CICD
运维·gitlab·jenkins
鹤鸣的日常4 天前
前端运行时动态环境变量方案
前端·react.js·docker·前端框架·vue·gitlab
starvapour5 天前
Ubuntu部署gitlab频繁出现502的问题
linux·ubuntu·gitlab
开发者联盟league5 天前
使用Jenkins整合Sonarqube/Gitlab/Harbor/Kubernetes的Demo工程
kubernetes·gitlab·jenkins
开发者联盟league5 天前
使用Jenkins整合Sonarqube/Gitlab/Harbor/Kubernetes实现CICD
kubernetes·gitlab·jenkins
zyl837215 天前
前后端项目自动部署方案主流实现方案
ci/cd·gitlab·github
tingting01196 天前
Anolis OS release 8.10安装gitlab
gitlab
shchojj6 天前
gitlab推送触发jekins编译
运维·gitlab