How to migrate CentOS 8 to CentOS Stream

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

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

Thanks to this development, current CentOS 8 users are left with two options: either upgrade to server-side distributions like Debian, openSUSE, Ubuntu LTS, or upgrade their current CentOS system to CentOS Stream.

In this tutorial, we will show you how you can upgrade your current CentOS 8 installation to CentOS Stream.

Upgrading CentOS 8 to CentOS Stream

The idea is simple. To convert, you need to add Stream repositories and remove existing ones.

Luckily, you don’t have to do all of this manually. The CentOS team provides a handy tool for this purpose.

Please make a backup before updating. The upgrade procedure is simple, but create a backup for that.

Step 1. Install repo files

Install the centos-release-stream package. It contains all the required repo files.

dnf install centos-release-stream -y

Step 2: update the system

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

dnf distro-sync -y

This will sync all local packets with upstream versions.

Step 3. Reboot and double check the installed version.

Now restart the server:

reboot

After successfully booting the system, test the migration by checking the CentOS version.

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

[[email protected] ~]# cat /etc/centos-release 
CentOS Stream release 8

Or read the centos-release file:

[[email protected] ~]# 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 result.

Is it safe to upgrade to CentOS Stream?

How careful should you be before starting an update? It’s safe? To be honest, we cannot tell you, “Come on, everything will be fine” with confidence. Many moving parts contribute to the stability of the system. This process does not guarantee that nothing will break.

To roughly test if the process would break all existing settings, we deployed a CentOS 8 server on Linode. On this server, we installed Nextcloud, that is, without containers, HTTPS is enabled. I also disabled SELinux and firewalld to speed things up a bit.

After installing the centos-release-stream package and running the dnf distro-sync command, only 101 packages needed to be updated. Then we updated and rebooted, luckily everything was fine.

But here’s the thing, this experiment of ours proves nothing. Anyway, it shows that not all existing settings will fail if you upgrade to CentOS Stream from 8. It still doesn’t confirm if it’s completely safe or not. The stability of your system after an upgrade depends on many factors, for example:

  • How many services are currently running on the server?
  • How are services configured or installed?
  • How many packages are currently installed?
  • When was it last updated?

This is why we suggest taking a snapshot of your system if you are running in a virtual machine. Make a backup because you can never be too careful.

Regarding service downtime, if your system is part of a cluster, the orchestrator must take care of the total number of running instances, excluding downtime. If you are using a single node docker environment, using the live-restore docker feature will eliminate any downtime in case a docker update is pending. Beyond that, your current downtime management methods should be good enough.

Sidebar