CentOS is a more stable and secure distribution of the famous Linux operating system. It was launched in 2004 and since then, different versions of this distribution were released for improving its overall performance. This article is specifically meant for the people who are running a CentOS 7 system and want to switch to a CentOS 8 system. This guide will walk you through the procedure of upgrading a CentOS 7 system to CentOS 8.
Procedure of Upgrading CentOS 7 to CentOS 8
To upgrade your CentOS 7 system to CentOS 8, you will have to proceed as explained in the following steps:
Step #1: Installation of the “EPEL” Repository
First, you need to install the “EPEL” repository by running the following command:
1 | $ yum install epel-release –y |
Step #2: Installation of the “yum-utils” Tools
After the installation of the “EPEL” repository on your CentOS 7 system, you have to install the “yum-utils” tools by running the following command:
1 | $ yum install yum-utils |
Once the “yum-utils” tools is installed successfully, you have to resolve all the RPM packages by running the following commands in the succeeding order:
1 | $ yum install rpmconf |
1 | $ rpmconf –a |
Soon after the resolution of the RPM packages, you should clean up all those packages that you no longer require. This can be done with the help of the two following commands:
1 | $ package-cleanup --leaves |
1 | $ package-cleanup --orphans |
Step #3: Installation of the “dnf” Package Manager
Then, you need to install the “dnf” package manager on your CentOS 7 system. We will use it for upgrading to CentOS 8. The “dnf” package manager can be installed with the help of the following command:
1 | $ yum install dnf |
After the successful installation of the “dnf” package manager, you have to remove the “yum” package manager so that it cannot cause any hindrance in the working of the “dnf” package manager. The “yum” package manager can be removed by running the following two commands:
1 | $ dnf –y remove yum yum-metadata-parser |
1 | $ rm –Rf /etc/yum |
Step #4: Upgrading CentOS 7 to CentOS 8
Now, you need to upgrade your CentOS 7 system with the help of the following command:
1 | $ dnf upgrade |
After running this command, you will be all set to install CentOS 8 on your system by running the following command:
1 | $ dnf install http://vault.centos.org/8.2.2004/BaseOS/x86_64/os/Packages/{centos-linux-repos-8-3.el8.noarch.rpm,centos-linux-release-8.2.1.2004.el8.noarch.rpm,centos-gpg-keys-8-3.el8.noarch.rpm} |
This installation will take some time to complete. After the installation, you need to upgrade your “EPEL” repository with the command given below:
1 | $ dnf –y upgrade https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm |
Once the “EPEL” repository has been upgraded, you need to clean up all the temporary files with the following command:
1 | $ dnf clean all |
After that, you are supposed to remove the CentOS 7 kernel with the command shown below:
1 | $ rpm –e `rpm –q kernel` |
Once the CentOS 7 kernel has been removed, you should also remove all the conflicting packages with the following command:
1 | $ rpm –e --nodeps sysvinit-tools |
Then, you need to upgrade your CentOS 8 system with the command shown below:
1 | $ dnf –y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync |
Step #5: Installation of the CentOS 8 Kernel Core
Now, you need to install the CentOS 8 kernel core with the following command:
1 | $ dnf –y install kernel-core |
After that, you also need to install the CentOS 8 minimal package with the command given below:
1 | $ dnf –y groupupdate “Core” “Minimal Install” |
Step #6: Verification of the Upgrade Process
Once this whole procedure has been performed, you can verify your upgrade process with the following command:
1 | $ cat /etc/redhat-release |
This command is used to list down the version of CentOS that you are running, as shown in the following image. You can verify that we have successfully upgraded to CentOS 8.
Conclusion
By following the steps exactly as explained in the method above, you will be able to upgrade from CentOS 7 to CentOS 8 within a few minutes. After doing that, you can easily enjoy all the perks of the latest CentOS release.