代码编织梦想

先看官方升级文档说明

官方文档链接

在这里插入图片描述

升级

  • 如果你的gitlab版本是10.0.2,那个要升级到15.4.2 首先得过度如下几个版本
    10.1.0、10.2.3、10.8.7、11.3.4、11.11.8、12.0.12、12.1.17、12.8.0、12.10.14、13.0.14、13.1.11、13.8.8、13.12.15、14.0.12、14.10.0、14.3.6、14.9.5、15.0.0、15.4.0、15.4.2

  • 准备工作(aliyun同学请进行快照备注)

# 停止服务
sudo gitlab-ctl stop

# 创建数据备份,防止更新失败
sudo gitlab-rake gitlab:backup:create
  • 升级通过以下命令进行
# 升级包下载链接(记得修改版本号):
wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-10.1.0-ce.0.el7.x86_64.rpm/download.rpm
# 首先停止gitlab现有服务
sudo gitlab-ctl stop
# 防止在升级过程中报错【错误-1】,执行以下命令
sudo gitlab-ctl start postgresql
rpm -Uvh [rpm包名]

错误

  • 一、 停止gitlab服务后未单独启动 postgresql,会报以下错误
Dumping database ... 
Dumping PostgreSQL database gitlabhq_production ... pg_dump: [archiver (db)] connection to database "gitlabhq_production" failed: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
[FAILED]
Backup failed
  • 二、在安装gitlab进行gitlab-ctl reconfigure的时候,碰到问题bash[migrate gitlab-rails database] (gitlab::database_migrations line 55) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received ‘1’ 报错database_migrations问题涉及数据库。使用gitlab-ctl stop停止gitlab服务,执行如下命令后重启gitlab即可。
chmod 0755 /var/opt/gitlab/postgresql
systemctl restart gitlab-runsvdir
#重启gitlab
gitlab-ctl reconfigure
gitlab-ctl restart
  • 三、如果垮大版本升级时报 :Your version of PostgreSQL is no longer supported. Please upgrade your PostgreSQL version to 11. 数据库版本错误,则升级PostgreSQL即可
sudo gitlab-ctl pg-upgrade
  • 四、如果报以下错误: gitLab-unicorn[‘port‘] has been deprecated since 13.10 and was removed in 14.0, 直接修改配置文件,重新配置即可

原因是 14.x 后版本,不再使用 unicorn ,改为使用 puma 作为web服务器。所以如果是升级操作,需要修改配置,按如下步骤。

修改 gitlab.rb 配置文件

  1. vim /etc/gitlab/gitlab.rb

  2. 注释掉所有 unicorn

  3. 按需打开 puma (删除前面的#,修改后面的值,一般是设置过端口,需要重新设置)
    在这里插入图片描述

gitlab-ctl reconfigure
  • 五、更新Gitlab后,gitlab-ctl reconfigure报错:
Running handlers:
There was an error running gitlab-ctl reconfigure:
rails_migration[gitlab-rails] (gitlab::database_migrations line 51) had an error: Mixlib::ShellOut::ShellCommandFailed: bash[migrate gitlab-rails database ] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/resources/rails_migration.rb line 16) had an error: Mixlib::ShellOut::ShellCommandFailed: Command execution failed. STDOUT/STDERR suppressed for sensitive resource

执行了一下:

sudo gitlab-rake db:migrate

执行完成后,我这边返回的结果是让我执行以下命令(每个版本返回的可能不一样)

sudo gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']

显示执行成功后,再执行

sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart

升级完成后的效果

在这里插入图片描述

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/baidu_33209239/article/details/127176212

GitLab 远程命令执行漏洞复现CVE-2021-22205-爱代码爱编程

雨笋教育小编今天分享我们工程师发布的关于GitLab 远程命令执行漏洞复现的一篇技术干货,分享给你们一起学习。 GitLab 官方发布安全补丁更新修复了GitLab命令执行漏洞(CVE-2021- 22205)。由于GitLab中的ExifTool没有对传⼊的图像文件的扩展名进行正确处理,攻击者通过 上传特制的恶意图片,可以在目标服务器上执行任意命令,且