Close this search box.

How to upgrade CentOS from 7 to 8 ​

Table of Contents

How to upgrade CentOS from 7 to 8



The new version of CentOS 8 offers the latest technologies, packages, and services and will continue to be supported until 2029. There is no official way to upgrade from CentOS 7 to CentOS 8, but unofficially it can be done. Production servers should not use such a procedure. Take a snapshot of your VPS before upgrading, so that you can restore it if necessary. So let’s start the upgrading process.



Step 1: Cleaning Up your current system



You should clean up your current system before you install CentOS 8 in order to avoid leftovers, unneeded packages, or conflicts.



First, ensure your system is up to date. Run the following command:

# yum update -y 



Install epel-release repository:

# yum install -y epel-release


Install the yum-utils and rpmconf packages:


# yum install -y yum-utils rpmconf


We’ll use rpmconf now that it has been installed to resolve our rpm packages:


# rpmconf -a


Lastly, ensure that any orphaned or unneeded packages have been removed:


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



Step 2: Replacing Packages



The next step involves replacing the important package and repository repositories with their CentOS 8 equivalents.  


Install the DNF package manager, which uses rpm packages:


# yum install -y dnf


Remove the yum package manager:


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


You should then run a DNF system update:


# dnf upgrade -y


Next, install the CentOS 8 packages:


# 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}


And upgrade the EPEL repository:


# dnf -y upgrade


As a last step, delete all temporary files:


# dnf clean all



Step 3: Install the New Kernel and Release


Installation of the new Linux kernel and the new CentOS 8 release is the last step in switching over to CentOS 8.


First, remove the old kernel:


# rpm -e `rpm -q kernel`


If there are any conflicting packages, remove them:


# rpm -e --nodeps sysvinit-tools


Upgrade CentOS 8:


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


To install the new kernel core, follow the command:


# dnf -y install kernel-core


After that, Run the CentOS 8 Minimal install:


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


Based on the os-release and redhat-release files, you can verify your CentOS version. Thanks for reading! I hope it was informative for you! 



Make a Comment
Share on
VPSie Cloud service

Fast and Secure Cloud VPS Service

For a month

The First 1 orders gets free discount today! Try Sign up on VPSie to get a chance to get the discount.