How to Upgrade CentOS 7 to CentOS 8 Linux

[‘

n

In this article, you will learn how to upgrade CentOS 7 to CentOS 8.5 release. The steps described herein do not depict the official upgrade and this should not be applied to a production server yet.

n

Step 1: Install the EPEL Repository

n

To start off, install the EPL repository by running:

n

# yum install epel-release -yrn

n

Install EPEL Repo in CentOS 7
Install EPEL Repo in CentOS 7

n

Step 2: Install yum-utils Tools

n

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

n

# yum install yum-utilsrn

n

Install yum-utils in CentOS 7
Install yum-utils in CentOS 7

n

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

n

# yum install rpmconfrn# rpmconf -arn

n

Keep Default RPM Settings
Keep Default RPM Settings

n

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

n

# package-cleanup --leavesrn# package-cleanup --orphansrn

n

Clean RPM Packages
Clean RPM Packages

n

Step 3: Install the dnf in CentOS 7

n

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

n

# yum install dnfrn

n

Install dnf in CentOS 7
Install dnf in CentOS 7

n

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

n

# dnf -y remove yum yum-metadata-parserrn# rm -Rf /etc/yumrn

n

Remove Yum in CentOS 7
Remove Yum in CentOS 7

n

Step 4: Upgrading CentOS 7 to CentOS 8

n

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.

n

# dnf upgradern

n

Upgrade CentOS 7
Upgrade CentOS 7

n

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

n

# dnf install http://vault.centos.org/8.5.2111/BaseOS/x86_64/os/Packages/{centos-linux-repos-8-3.el8.noarch.rpm,centos-linux-release-8.5-1.2111.el8.noarch.rpm,centos-gpg-keys-8-3.el8.noarch.rpm}rn

n

Note: CentOS 8 is dead and all the repos have been moved to vault.centos.org.

n

Install CentOS 8 Release Packages
Install CentOS 8 Release Packages

n

Next, upgrade the EPEL repository.

n

dnf -y upgrade https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpmrn

n

Upgrade EPEL Repository
Upgrade EPEL Repository

n

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

n

# dnf clean allrn

n

Remove the old kernel core for CentOS 7.

n

# rpm -e `rpm -q kernel`rn

n

Remove Old CentOS 7 Kernel
Remove Old CentOS 7 Kernel

n

Next, be sure to remove conflicting packages.

n

# rpm -e --nodeps sysvinit-toolsrn

n

Thereafter, launch the CentOS 8 system upgrade as shown.

n

# dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-syncrn

n

CentOS 8 System Upgrade
CentOS 8 System Upgrade

n

Note: If you get errors about conflicting packages, for example in my case there were conflicts about the existing python36-rpmconf package. I removed this package, similarly if you get any conflicts just remove those packages and try running the above upgrade command.

n

Step 5: Install the New Kernel Core for CentOS 8

n

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

n

# dnf -y install kernel-corern

n

Install Kernel in CentOS 8
Install Kernel in CentOS 8

n

Finally, install CentOS 8 minimal package.

n

# dnf -y groupupdate "Core" "Minimal Install"rn

n

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

n

# cat /etc/redhat-releasern

n

Check CentOS Version
Check CentOS Version

n

If you see the above output, I have successfully upgraded from CentOS 7 to CentOS 8.5 release.

n

Read Also: How to Set Up Automatic Updates for CentOS 8

n

Conclusion

n

This article concludes on how you can upgrade from CentOS 7 to CentOS 8. We hope you found this insightful.

n

‘]