Gitlab升级,有非常固定的路线,请参考:《gitlab升级路线》。
如果跨版本升级,就会报错:
(Reading database ... 125983 files and directories currently installed.)
Preparing to unpack .../gitlab-ce_15.1.2-ce.0_amd64.deb ...
gitlab preinstall: It seems you are upgrading from major version 14 to major version 15.
gitlab preinstall: It is required to upgrade to the latest 15.0.x version first before proceeding.
gitlab preinstall: Please follow the upgrade documentation at https://docs.gitlab.com/ee/update/index.html#upgrade-paths
dpkg: error processing archive /var/cache/apt/archives/gitlab-ce_15.1.2-ce.0_amd64.deb (--install):
new gitlab-ce package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/gitlab-ce_15.1.2-ce.0_amd64.deb
应该根据gitlab的升级路线,一步一步升级。
先从gitlab的管理后台查看版本,确定升级步骤,一步一步升级即可。
我这里的版本是:14.10.2,所以,我先升级到 15.0.0,
sudo apt update && sudo apt install gitlab-ce=15.0.0-ce.0 -y
然后再升级到最新版本:
sudo apt update && sudo apt install gitlab-ce -y
或者执行:
sudo apt update && sudo apt-get upgrade -y
建议执行第二个,因为这个不但升级了gitlab,还把相应的组件同样升级了,能从一定程度上避免依赖的版本冲突。