官方的升级指引:
https://docs.gitlab.com/ee/update/index.html#upgrade-paths
升级路径:
12.3.9 -> 12.10.14 -> 13.0.14 -> 13.12.15 -> 14.0.11 -> 14.1.8 -> 14.4.5 -> 14.7.3
如果使用YUM方式,可以设置使用官方YUM源,非必要步骤
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash
下载安装包,下载到/opt/gitlab_soft
cd /opt/gitlab_soft
wget http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.10.14-ce.0.el7.x86_64.rpm
wget http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-13.0.14-ce.0.el7.x86_64.rpm
wget http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-13.12.15-ce.0.el7.x86_64.rpm
wget http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.0.12-ce.0.el7.x86_64.rpm
wget http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.1.8-ce.0.el7.x86_64.rpm
wget http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.4.5-ce.0.el7.x86_64.rpm
wget http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.7.3-ce.0.el7.x86_64.rpm
1、关闭服务
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-ctl stop nginx
2、备份gitlab:
创建备份文件夹
mkdir -p /opt/backup/local220217_1/opt/
备份运行文件
cp -r /opt/gitlab /opt/backup/local220217_1/opt/
cp -r /etc/gitlab /opt/backup/local220217_1/etc/
备份数据库,默认会在/var/opt/gitlab/backups文件夹下生成备份文
gitlab-rake gitlab:backup:create
3、设置跳过自动备份
touch /etc/gitlab/skip-auto-backup
4、修改配置文件/etc/gitlab/gitlab.rb
unicorn['worker_memory_limit_min'] = "1024 * 1 << 20"
unicorn['worker_memory_limit_max'] = "1280 * 1 << 20"
5、切换到有安装包的目录
cd /opt/gitlab_soft
6、升级为12.10.14
rpm -Uvh gitlab-ce-12.10.14-ce.0.el7.x86_64.rpm
gitlab-ctl reconfigure 【如果提示redis报错,执行6.1步骤】
sudo gitlab-ctl pg-upgrade
gitlab-ctl restart
6.1、【非必要步骤】如果redis报错,则暂停redis服务,删除临时文件
暂停redis服务
gitlab-ctl stop nginx
删除redis数据文件
rm -rf /var/opt/gitlab/redis/dump.rdb
启动redis服务
gitlab-ctl start redis
7、升级为13.0.14
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-ctl stop nginx
修改配置文件/etc/gitlab/gitlab.rb将设置unicorn为false
注意把unicorn其他相关的配置也要使用##注释去掉,另外,puma默认开启,无需配置
rpm -Uvh gitlab-ce-13.0.14-ce.0.el7.x86_64.rpm
gitlab-ctl restart 【如果提示postgresql数据库报错,执行7.1步骤】
7.1、如果提示postgresql数据库报错,可能数据库目录权限不足
##gitlab-ctl stop
##chmod 755 /var/opt/gitlab/postgresql
##systemctl restart gitlab-runsvdir
##gitlab-ctl reconfigure
##gitlab-ctl restart
8、升级为13.12.15
gitlab-ctl stop puma
gitlab-ctl stop sidekiq
gitlab-ctl stop nginx
rpm -Uvh gitlab-ce-13.12.15-ce.0.el7.x86_64.rpm
gitlab-ctl restart
##gitlab-ctl pg-upgrade
##gitlab-ctl reconfigure
##gitlab-ctl restart
9、升级为14.0.12
gitlab-ctl stop puma
gitlab-ctl stop sidekiq
gitlab-ctl stop nginx
rpm -Uvh gitlab-ce-14.0.12-ce.0.el7.x86_64.rpm
gitlab-ctl restart postgresql
gitlab-ctl reconfigure
gitlab-ctl restart
10、升级为14.1.8
gitlab-ctl stop puma
gitlab-ctl stop sidekiq
gitlab-ctl stop nginx
rpm -Uvh gitlab-ce-14.1.8-ce.0.el7.x86_64.rpm
gitlab-ctl restart
11、升级为14.4.5
gitlab-ctl stop puma
gitlab-ctl stop sidekiq
gitlab-ctl stop nginx
rpm -Uvh gitlab-ce-14.4.5-ce.0.el7.x86_64.rpm
gitlab-ctl restart
12、升级为14.7.3
gitlab-ctl stop puma
gitlab-ctl stop sidekiq
gitlab-ctl stop nginx
rpm -Uvh gitlab-ce-14.7.3-ce.0.el7.x86_64.rpm
gitlab-ctl restart
13、删除跳过自动备份的设置
rm /etc/gitlab/skip-auto-backup