How to Switch From CentOS 8 to CentOS Stream

Edit: Please check out Anthony Geoghegan's answer for the latest recommendations.

This should work as CentOS Stream is just additional repositories on top of CentOS 8 as mentioned on (unofficial) centosfaq.org.

I did this on my development machine:

$ dnf history centos-release-stream
ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
   156 | update --allowerasing    | 2020-03-27 14:10 | E, I, U        |  127  <
   154 | install -y centos-releas | 2020-03-27 14:04 | Install        |    1 > 

Which resulted in the following enabled repositories

$ dnf repolist enabled | grep CentOS
AppStream                 CentOS-8 - AppStream
BaseOS                    CentOS-8 - Base
PowerTools                CentOS-8 - PowerTools
Stream-AppStream          CentOS-Stream - AppStream
Stream-BaseOS             CentOS-Stream - Base
Stream-extras             CentOS-Stream - Extras
centosplus                CentOS-8 - Plus
extras                    CentOS-8 - Extras
fasttrack                 CentOS-8 - fasttrack

I needed to get rid of some manually compiled packages (--allowerasing) though. I would not do this on a production server or without a functioning backup.


After, it was announced that CentOS 8 would no longer be supported (end-of-life on 31 December 2021), upgrading to CentOS Stream became the officially recommended path to continue to receive software updates (RPMs).

Here are the notes I made while following the instructions for Converting from CentOS Linux to CentOS Stream:

1. Install the CentOS-Stream release files.

dnf install centos-release-stream

This package installs the following files:

/etc/dnf/vars/stream
/etc/yum.repos.d/CentOS-Stream-AppStream.repo
/etc/yum.repos.d/CentOS-Stream-Base.repo
/etc/yum.repos.d/CentOS-Stream-Debuginfo.repo
/etc/yum.repos.d/CentOS-Stream-Extras.repo
/etc/yum.repos.d/CentOS-Stream-Media.repo
/etc/yum.repos.d/CentOS-Stream-PowerTools.repo
/etc/yum.repos.d/CentOS-Stream-Sources.repo
/etc/yum.repos.d/CentOS-Stream-Vault.repo
/etc/yum.repos.d/CentOS-Stream-centosplus.repo

2. Replace the centos-linux repositories with centos-stream repositories:

dnf swap centos-{linux,stream}-repos

This replaces the following packages:

centos-release-stream
centos-release
centos-repos

with

centos-stream-repos
centos-stream-release

3. Update all packages to match the latest version available from all enabled repositories

sudo dnf distro-sync

For me, this installed a large number of packages, removed older kernel packages and downgraded the following packages:

httpd-2.4.37-30.module_el8.3.0+462+ba287492.0.1.x86_64
httpd-filesystem-2.4.37-30.module_el8.3.0+462+ba287492.0.1.noarch
httpd-tools-2.4.37-30.module_el8.3.0+462+ba287492.0.1.x86_64

However, it failed while attempting to upgrade the filesystem package and further attempts to run dnf update failed due to:

Error unpacking rpm package filesystem-3.8-4.el8.x86_64

This was because I had a filesystem mounted on /mnt. Unmounting this allowed the filesystem package to be upgraded and allowed the operation to complete successfully:

$ cat /etc/centos-release
CentOS Stream release 8

Note: I’ve only converted my own workstation to CentOS Stream. I have yet to replicate this procedure on a production server. :)

Tags:

Upgrade

Centos