动态

详情 返回 返回

GitLab 從 17.10 到 18.0.1 的升級指南 - 动态 详情

本文分享從 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

可以看到當前版本為 17.10.0

開始升級

由於 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

過程中再也沒有遇到開頭的問題。

user avatar u_17469189 头像 ting_61d6d9790dee8 头像 definecloud 头像 k21vin 头像 fennudebiandang 头像
点赞 5 用户, 点赞了这篇动态!
点赞

Add a new 评论

Some HTML is okay.