Instructions to update Gitlab CE version

by Daniel Pham
Published: Updated:
This entry is part 6 of 9 in the series Install Gitlab CE on Ubuntu 18

Instructions to update Gitlab CE version. In this article, I will guide you how to update the Gitlab CE version.

If you have been installing the Gitlab server according to this series of instructions, updating will be quite simple. You can also refer to the update documentation from Gitlab.

Usage environments include:

  • Ubuntu server 18.04 64bit
  • Gitlab CE 12.8.1

Important note

Gitlab, like any other system, when updating a version has certain potential risks. Eg:

  • Update causes database error
  • Updating to the new version makes it impossible to log in
  • Incompatibility error with software packages, AD/LDAP authentication integration…
  • After updating, the service cannot be restarted, the service has a restart loop phenomenon

So there are 3 things to note before updating any system, not just Gitlab.

Note 1: always perform a backup before updating

This sounds very common but is very important. And this can save your life in case you mess up.

Note 2: always perform a test/test update on a clone/test system before performing it on the main system

Depending on the scale and conditions of the system, you should consider building a system that simulates the main system on a small scale. Please perform a test update on this system and see if the results are ok. If everything is fine, proceed to update the main system.

Note 3: always have a rollback plan

No matter how you update the system, there needs to be a plan/plan to roll back the system to the way it was before the update. What do you need to prepare, what steps do you need to take, how long do you need to do it,… List all those steps into a file and use it in case the update fails.

General Gitlab version update command

Instructions to update Gitlab CE version
Instructions to update Gitlab CE version.

For those of you who install Gitlab CE through the repository, the update command is quite simple as follows.

For Debian/Ubuntu:

apt-get update
apt-get install gitlab-ce

For RedHat/CentOS:

yum update
yum install gitlab-ce

Update Gitlab version according to major version

But life is not as simple as a dream, hehe. There is an important point when updating Gitlab, which is the major version.

For example, I am using Gitlab 12.8.1 and I have not updated the system for a long time.

After a while, Gitlab released version 13.2.2. When I execute the update command as above, I get an error.

The following packages will be upgraded:
  gitlab-ce
1 upgraded, 0 newly installed, 0 to remove and 71 not upgraded.
Need to get 0 B/760 MB of archives.
After this operation, 137 MB disk space will be freed.
(Reading database ... 210899 files and directories currently installed.)
Preparing to unpack .../gitlab-ce_13.2.2-ce.0_amd64.deb ...
gitlab preinstall: It seems you are upgrading from major version 12 to major version 13.
gitlab preinstall: It is required to upgrade to the latest 13.0.x version first before proceeding.
gitlab preinstall: Please follow the upgrade documentation at https://docs.gitlab.com/ee/policy/maintenance.html#upgrade-recommendations
dpkg: error processing archive /var/cache/apt/archives/gitlab-ce_13.2.2-ce.0_amd64.deb (--unpack):
 new gitlab-ce package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/gitlab-ce_13.2.2-ce.0_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

With the above error message, it means I cannot update directly from version 12.x to version 13.x.

Accordingly, I will have to update the current version I am using to the latest version of major 12.x. Next, I can update to version 13.x.

So now how to perform the update?

Determines the current version of Gitlab CE

Now how do I know which version of Gitlab 12.8.1 I need to update to?

Very simply and most accurately, please look at Gitlab’s own changelog file. In this CHANGELOG.md file, all versions and corresponding features of each version are recorded.

And after viewing the changelog, I have identified the versions that must be updated as follows.

  • 12.8.1 (current) -> 12.10.14 (latest of 12.x)
  • 12.10.14 -> 13.0.10 (latest of 13.0.x)
  • 13.0.10 -> 13.2.2 (latest of 13.x)

Please note that you cannot update directly from 12.10.14 to 13.2.2. You must update to version 13.0.x first. You can see Gitlab’s documentation about this, under Example Upgrade Paths.

Perform updates according to major version

To check which version of Gitlab you are using (just to be sure), you can run this command.

grep gitlab /opt/gitlab/version-manifest.txt

Now to update from 12.8.1 to 12.10.14, type the command.

apt-get install gitlab-ce=12.10.14-ce.0

After successfully updating to 12.10.14, to update to 13.0.10, type the command.

apt-get install gitlab-ce=13.0.10-ce.0

Finally, to update from 13.0.10 to 13.2.2, type the command.

apt-get install gitlab-ce

Note: during the update process, each time a version is updated, the Gitlab system will automatically create a backup file for the version before updating. If you perform multiple consecutive updates as above, you need to make sure the server has enough disk space.

Conclusion

Above, I have presented all the points to note as well as the process and ways for you to update the version of the Gitlab system safely and successfully. In the next article, I will talk about Gitlab server migration.

0 0 votes
Article Rating
Series Navigation«« Previous part: Script to backup Gitlab CE data to Amazon S3Next part: Migrate Gitlab CE to new server »»

You may also like

Subscribe
Notify of
guest
2 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Yên
Yên
Guest
2 years ago

13.3.1 — 13.8.8 — 13.12.15 — 14.0.12 — 14.8.3 đúng không anh ??

Yên
Yên
Guest
2 years ago

Hi anh ! Version Gitlam-ce của em hiện tại là 13.3.1 em muốn update lên 14.8.3. Thì update như thế nào ạ ? Em vẫn chưa rõ đường đi của version ạ ?? Cảm ơn anh !

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.

SUPPORT US

FOLLOW US

Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 DevOpsLite.com – All rights reserved.

Please write sources “DevOpsLite.com” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

2
0
Would love your thoughts, please comment.x
()
x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.