How to Migrate CentOS 8 to CentOS Stream

Red Hat and CentOS recently announced that CentOS will be converted to a rolling release distribution in the form of CentOS Stream.

While CentOS 7 will be supported till 2024, CentOS 8 support ends by the end of 2021.

With this development, the current CentOS 8 users are left with three choices, either move to server distributions like Debian, openSUSE, Ubuntu LTS, or update the current CentOS system to CentOS Stream or opt for a free RHEL subscription (for up to 16 servers).

In this tutorial, I'm going to show you how you can update your current CentOS 8 install to CentOS Stream.

Upgrading CentOS 8 to CentOS Stream

The idea is simple. To convert, you need to add Stream's repos, and remove the existing ones.

Fortunately, you don't have to do all that manually. There is a handy tool provided by the CentOS team for this purpose.

Make a backup before you update. The update procedure is simple but create backup for the sake of it.

Step 1: Install the repo files

Install the package centos-release-stream. This contains all the repo files that are needed.

dnf install centos-release-stream -y

Step 2: Update the system

Update the system or the packages to be specific, by running the distro-sync command.

dnf distro-sync -y

This syncs all the local packages to the upstream's versions.

Step 3: Reboot and double-check the installed version

Now, reboot your server:

reboot

After the system is booted successfully, verify the migration by checking the CentOS version.

You can do that by reading the os-release file:

[root@li2029-76 ~]# cat /etc/centos-release 
CentOS Stream release 8

Or, read the centos-release file:

[root@li2029-76 ~]# cat /etc/os-release 
NAME="CentOS Stream"
VERSION="8"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Stream 8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://centos.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_SUPPORT_PRODUCT_VERSION="CentOS Stream"

You should see a similar output.

I have made a video of the entire process. The video is being edited but you can follow it nonetheless.

Is it safe to upgrade to CentOS Stream?

How careful should you be before starting the update? Is it safe? To be honest, I can't tell you "Oh do it, it'll be just alright" in confidence. A lot of moving parts contribute to the stability of a system. This process doesn't exactly make sure nothing will break.

To roughly test whether the process will break all of the existing setups or not, I deployed a CentOS 8 server on Linode. On this server, I installed Nextcloud, natively i.e. no containers, HTTPS enabled. I also disabled SELinux and firewalld just to make the process slightly faster.

After installing the centos-release-stream package and running the dnf distro-sync command, there was a total of 101 packages that needed to be updated. I updated and rebooted afterwards, fortunately, everything was just fine.

But here's the thing, this experiment of mine is no proof of anything. If anything, this shows that not all of the existing setups will break, if you're updating to CentOS Stream from 8. This still doesn't confirm whether it's totally safe or not. The stability of your system post-upgrade, depends on a lot of things, like:

  • How many services is the server currently running?
  • How the services are set up or installed?
  • How many packages does it currently have installed?
  • When was the last time it was updated?

This is why I suggest taking a snapshot of your system if you are running in a VM. Take backup because you can never be too careful.

As for service downtime, if your system is part of a cluster, the orchestrator should take care of the total number of running instances, eliminating downtime. If you're using a single node docker environment, using the live-restore feature of docker will eliminate any downtime in case a docker update is on the queue. Other than that, your current methods of countering any downtime should be good enough.

I hope this article was helpful to you. You can reach me @imdebdut, or @linuxhandbook. You can also join our Telegram group.