How to easily upgrade from CentOS 7 to CentOS 8.1.x

The following are the instructions for upgrading from CentOS 7 to CentOS 8.

First we need to login as sudo

sudo su

Update your system by using YUM:

yum update -y

Double-check you have the epel-release repository installed:

yum install -y epel-release

Install the yum-utils and rpmconf packages:

yum install -y yum-utils rpmconf

Resolve rpm packages and use option ‘N’ to keep the already installed version.

rpmconf -a

Cleanup orphaned packages:

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


Before switching to CentOS 8 – replace system packages and repositories with CentOS 8 equivalents. We will start by installing the DNF – rpm-based package manager.

yum install -y dnf

Then we’ll remove the YUM manager:

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

Once done, let’s run a DNF based system update.

dnf upgrade -y

Now we can start installing the packages needed for CentOS 8.

The latest mirror can be found here:

At the time of writing the post, the latest is: CentOS 8.1-1.1911.0.9 from 2020 March 12.

dnf install{centos-release-8.1-1.1911.0.9.el8.x86_64.rpm,centos-gpg-keys-8.1-1.1911.0.9.el8.noarch.rpm,centos-repos-8.1-1.1911.0.9.el8.x86_64.rpm}dnf install{centos-release-8.1-1.1911.0.8.el8.x86_64.rpm,centos-gpg-keys-8.1-1.1911.0.8.el8.noarch.rpm,centos-repos-8.1-1.1911.0.8.el8.x86_64.rpm}

Then we need to upgrade the EPEL repository:

dnf -y upgrade

Then we can clean up the temp files:

dnf clean all


Now, let’s switch from CentOS 7 to CentOS 8.1. We’ll need to remove the old Linux kernel first. And remove any conflicting packages:

rpm -e `rpm -q kernel`
rpm -e --nodeps sysvinit-tools

Next, start the CentOS 8 upgrade. Note, this will take up to 20 minutes depending on your connection speed, as approximately 840+ packages need to be downloaded, verified, cleaned and installed and some also removed.

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

Once done, you’ll see a screen like this:

Then we’re ready to install the new kernel core, which won’t take more than 20 seconds.

dnf -y install kernel-core

And run the CentOS 8 Minimal install:

dnf -y groupupdate "Core" "Minimal Install"

When done, you’ll see a message that the process was completed:

And Voila!, we have successfully upgraded from CentOS 7 to the latest CentOS 8.1.x release.

The last step is to verify our CentOS’s version:

cat /etc/os-release

cat /etc/redhat-release

Once the upgrade is completed, make sure to open the necessary ports, as these might be disabled after the upgrade to CentOS 8.

For example, if you need to permanently open the port 8080, run

firewall-cmd --zone=public --permanent --add-port 8080/tcp

And reload the firewall:

firewall-cmd --reload


Facebook Comments