极狐GitLab 正式推出面向 GitLab 老旧版本(12.x、13.x、14.x、15.x 等)免费用户的专业升级服务,点击查看详情

返回列表 发布新帖

GitLab 从 17.10 到 18.0.1 的升级指南

48 0

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×

本文分享从 GitLab 中文本 17.10.0 升级到 18.0.1 的完整过程。

升级前提

查看当前安装实例的版本。有多种方式可以查看:

  • 方式一:/help页面

可以直接在 /help 页面查看当前实例的版本。以极狐GitLab SaaS 为例,在浏览器中输入 https://jihulab.com/help 即可看到对应的版本:

可以看到当前版本为 17.10.0

  • 方式二:apt policy 命令行

可在 GitLab 所在服务器上执行 apt policy gitlab-jh,即可看到当前安装版本和候选版本(Ubuntu OS 使用 apt,CentOS 可以使用 yum):

gitlab-jh:
  Installed: 17.10.0-jh.0
  Candidate: 18.0.1-jh.0

可以看到当前版本为 <span data-type="text">17.10.0</span>

开始升级

由于 17.10.0 到 18.0.1 可以直接升级,可以执行如下命令可以直接升级:

apt update && apt install gitlab-jh
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libc-ares2 libjs-highlight.js libnode72 python3-cliapp python3-markdown python3-pygments python3-ttystatus
Use 'apt autoremove' to remove them.
The following packages will be upgraded:
  gitlab-jh
1 upgraded, 0 newly installed, 0 to remove and 84 not upgraded.
Need to get 0 B/1549 MB of archives.
After this operation, 87.5 MB disk space will be freed.
(Reading database ... 267880 files and directories currently installed.)
Preparing to unpack .../gitlab-jh_18.0.1-jh.0_amd64.deb ...
gitlab preinstall: Automatically backing up only the GitLab SQL database (excluding everything else!)
......太长了......

升级成功即可看到如下内容:

这会儿可以通过开头提到的两种方法查看版本即可:

可以看到当前实例已经升级到了最新的 18.0.1。

注意:GitLab 的升级一定要查看升级路径,严格按照升级路径来进行升级,否则很容易出现问题。升级路径可以登录https://gitlab.cn/support/toolbox/upgrade-path/ 查看。

问题解决

开始升级的时候,执行升级命令总是会出现如下错误:

dpkg: error processing archive /var/cache/apt/archives/gitlab-jh_18.0.0-jh.0_amd64.deb (--unpack):
 new gitlab-jh package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/gitlab-jh_18.0.0-jh.0_amd64.deb
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

所以,怀疑与内置的 PostgreSQL 版本问题有关,因为 18.0 版本明确表示内置的 PostgreSQL 版本必须为** 16.x。所以查看了一下当前实例安装的 PostgreSQL ,发现版本是 14.17(查看方法可以查看如何查看 GitLab 内置的 PostgreSQL 版本?中的描述)。所以计划先升级到 17.11。

执行如下命令进行了到 17.11.2 的升级:

apt install gitlab-jh=17.11.2-jh.0

安装完成后,查看了一下内置的 PostgreSQL 版本:

                                                version
-------------------------------------------------------------------------------------------------------
 PostgreSQL 16.8 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit
(1 row)

可以看到 PostgreSQL 的版本已经从 14.17升级到了 16.8

然后执行了如下命令直接升级到了 18.0.1

apt install gitlab-jh

过程中再也没有遇到开头的问题。

开心交流,交流开心。
回复

使用道具 举报

意见建议

Email:forum@gitlab.cn
  • 关注公众号
  • 添加专业顾问
Copyright © 2001-2025 极狐GitLab论坛 版权所有 All Rights Reserved. 鄂ICP备2021008419号-1|鄂公网安备42018502006137号
关灯 快速发帖
扫一扫添加专业顾问
返回顶部
快速回复 返回顶部 返回列表