极狐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
相关推荐
木雷坞12 小时前
csdn-enterpriseGitLab Runner docker pull 慢:并行流水线镜像拉取排查
运维·docker·容器·gitlab
一只大袋鼠12 小时前
Git (三):Tag 标签管理、图形工具、IDEA 集成与 GitLab 私有化部署
开发语言·git·gitlab
Lyra_Infra3 天前
故障排查报告:GitLab 18.11.3 后台 Settings 500
gitlab
Mike_6665 天前
git@gitlab-rdc.xxxxx.com: Permission denied (publickey).fatal: 无法读取远程仓库。
git·elasticsearch·gitlab
雨声不在8 天前
gitlab ci Runner 配置
gitlab·cicd
曾庆睿9 天前
【基于 RHEL 9.3 的 K8s + GitLab 全自动化部署环境搭建第一篇】
kubernetes·自动化·gitlab
曾庆睿9 天前
【基于 RHEL 9.3 的 K8s + GitLab 全自动化部署环境搭建第二篇】
kubernetes·自动化·gitlab
xmlhcxr13 天前
从 0 到 1 落地企业级 DevOps CI/CD 流水线:基于 GitLab+Jenkins+Harbor 的完整实践
运维·docker·gitlab·jenkins·harbor·devops
高旭的旭14 天前
GitLab Omnibus Docker 内存优化实战:从 4.7 GiB 降到 3.2 GiB
docker·容器·gitlab