Upgrade CentOS

How to Upgrade CentOS 7 to CentOS 8

CentOS version number is to execute the cat /etc/centos-release commandCentOS 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.

cat /etc/centos-release

[root@c8 ~]# yum update -y

How to find if Linux is running on 32-bit or 64-bit

  1. Open the Linux terminal application.
  2. Type uname -a to print system information.
  • Run getconf LONG_BIT to see if Linux kernel is 32 or 64 bit.
  • Execute grep -o -w ‘lm’ /proc/cpuinfo command to determine if you are using 32 or 64 bit CPU

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:

Before starting currently centos 7 server

[root@c8 ~]# cat /etc/centos-release

Step #1: Installation of the “EPEL” Repository

First, you need to install the “EPEL” repository by running the following command:

If you are using Proxy Server please disable while installation and upgrading server.

[root@c8 ~]# 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:

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:

[root@c8 ~]# 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:

[root@c8 ~]# package-cleanup –leaves   

[root@c8 ~]# package-cleanup –leaves

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:

[root@c8 ~]# 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:

[root@c8 ~]# dnf –y remove yum yum-metadata-parser

[root@c8 ~]# 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:

[root@c8 ~]# dnf upgrade

After running this command, you will be all set to install CentOS 8 on your system by running the following command:

[root@c8 ~]# 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}

Finally upgraded with centos 8

This installation will take some time to complete. After the installation, you need to upgrade your “EPEL” repository with the command given below:

[root@c8 ~]# dnf –y upgrade https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

Or

[root@c8 ~]# dnf 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:

[root@c8 ~]# dnf clean all

After that, you are supposed to remove the CentOS 7 kernel with the command shown below:

[root@c8 ~]# 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:

[root@c8 ~]# rpm –nodeps sysvinit-tools

Then, you need to upgrade your CentOS 8 system with the command shown below:

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:

[root@c8 ~]# dnf install kernel-core

After that, you also need to install the CentOS 8 minimal package with the command given below:

[root@c8 ~]# 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:

Cat /etc/os-release

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.