版本:9.0.3
升级版本:9.0.13
一,停止服务
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-ctl stop nginx
二,备份
gitlab-rake gitlab:backup:create
rpm -e gitlab-ce-9.0.3-ce.0.el7.x86_64 =====》卸载旧版gitlab
三,下载新版RPM ===》使用清华开源镜像网站
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
rpm -ivh gitlab-ce-9.0.13-ce.0.el7.x86_64.rpm
四,更改配置文件 ====》
########################如使用的时是MySQL数据库,查看我的另一篇
https://www.cnblogs.com/zy1234567/p/9971409.html
##############################################################
vim /etc/gitlab/gitlab.rb
external_url 'http://10.2.177.57:8090'
保存退出
五,启动服务
gitlab-ctl reconfigure
gitlab-ctl start
##########################################升级##################################
9.0.13-》9.5.9-》10.0->10.3.9->10.6.6-》10.8-》11.0
一,关闭服务
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-ctl stop nginx
二,安装依赖
yum install policycoreutils-python.x86_64
三,下载RPM
gitlab-ce-11.4.5-ce.0.el7.x86_64.rpm
chmod 777 gitlab-ce-11.4.5-ce.0.el7.x86_64.rpm
四,升级
rpm -Uvh gitlab-ce-11.4.5-ce.0.el7.x86_64.rpm =====》如果你是MySQL这里会报mysql2 gem问题,忽略,进行重新配置后,使用gitlab-ctl reconfigure,这个问题会解决
五,重新配置gitlab
vim /etc/gitlab/gitlab.rb ====》初次升级修改,二次/多次升级不用修改
vim /opt/gitlab/embedded/service/gitlab-rails/.bundle/config ====>消除postgres依赖 ,适用于MySQL数据库
#############################
报错:缺少mysql2==>安装mysql2报错===》缺少ruby.h
原因:/opt/gitlab/embedded/bin/ruby 版本与/usr/loacl/bin/ruby 或/usr/bin/ruby版本不一致
解决方案:
手动安装/opt/gitlab/embedded/bin/ruby 对应的版本、
cp /usr/local/include/ruby-2.4.0/* /opt/gitlab/embedded/lib/ruby/include/
cd /opt/gitlab/embedded/lib/ruby/include/
cp x86_64-linux/ruby/config.h ./ruby/
cd /opt/gitlab/embedded/
mkdir include && cd include
cp -r /usr/local/include/* .
/opt/gitlab/embedded/bin/gem install -i /opt/gitlab/embedded/service/gem/ruby/2.3.0/ mysql2 --version='0.4.10'
/opt/gitlab/embedded/bin/gem install mysql2 --version='0.4.10'
/opt/gitlab/embedded/bin/gem list | grep -i mysql2
/opt/gitlab/embedded/bin/gem install -i /opt/gitlab/embedded/service/gem/ruby/2.3.0/ peek-mysql2 -v'1.1.0'
/opt/gitlab/embedded/bin/gem install peek-mysql2 -v'1.1.0'
gitlab-ctl reconfigure
##################################### =====》直接进行gitlab-ctl restart
####################################
报错:缺少MySQL2 ====》没有报缺少ruby.h ===========》初次升级9.5,不需要升级ruby,所以没报缺少ruby.h
gem install mysql2 -v"0.4.5" 如果不行用下面的这条
/opt/gitlab/embedded/bin/gem install -i /opt/gitlab/embedded/service/gem/ruby/2.3.0/ mysql2 -v'0.4.5' =====>版本看提示
若缺少依赖:
/opt/gitlab/embedded/bin/gem install -i /opt/gitlab/embedded/service/gem/ruby/2.3.0/ peek-mysql2 -v'1.1.0'
/opt/gitlab/embedded/bin/gem install peek-mysql2 -v'1.1.0'
#########################################
登陆mysql给git@localhost赋权限:
grant all privileges on *.* to 'git'@'localhost';
flush privilges;
gitlab-ctl reconfigure
六,重启gitlab
gitlab-ctl restart
七,检查运行状况:
gitlab-rake gitlab:check