How to upgrade CentOS 7 to CentOS 8

In this article, you will learn how to upgrade CentOS 7 to CentOS 8.
The CentOS Project is a community-driven free software effort focused on delivering a robust open source ecosystem around a Linux platform.

Note: Make a server copy before making any updates.

Step 1: Install the EPEL repository

To start off, install the EPL repository by running:

yum install epel-release -y

Step 2: Install yum-utils tools

After successfully installing EPEL, install yum-utils by running the command below.

yum install yum-utils

Thereafter, you need to resolves RPM packages by executing the command.

yum install rpmconf
rpmconf -a

Next, perform a clean-up of all the packages you don’t require.

package-cleanup --leaves
package-cleanup --orphans

Step 3: Install the dnf in CentOS 7

Now install dnf package manager which is the default package manager for CentOS 8.

yum install dnf

You also need to remove the yum package manager using the command.

dnf remove yum yum-metadata-parser
rm -Rf /etc/yum

Step 4: Upgrading CentOS 7 to CentOS 8

We are now ready to upgrade CentOS 7 to CentOS 8, but before we do so, upgrade the system using the newly install dnf package manager.

dnf upgrade

Next, install CentOS 8 release package using dnf as shown below. This will take a while.

dnf -y upgrade

Next, upgrade the EPEL repository.

dnf -y upgrade

After successfully upgrading the EPEL repository, remove all the temporary files.

dnf clean all

Remove the old kernel core for CentOS 7.

rpm -e `rpm -q kernel`

Next, be sure to remove conflicting packages.

rpm -e --nodeps sysvinit-tools

Thereafter, launch the CentOS 8 system upgrade as shown.

dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync

Step 5: Install the new kernel core for CentOS 8

To install a new kernel for CentOS 8, run the command.

dnf -y install kernel-core

Finally, install CentOS 8 minimal package.

dnf -y groupupdate "Core" "Minimal Install"

Now you can check the version of CentOS installed by running.

cat /etc/redhat-release

This article provides an example of how you can upgrade CentOS 7 to CentOS 8. We hope you found this insightful.

Leave a Reply

Your email address will not be published. Required fields are marked *