How to Upgrade CentOS 7 to CentOS 8

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

Step 1: Install the EPEL Repository

To start off, install the EPL repository by running:

# yum install epel-release -y
Install EPEL Repo in CentOS 7
Install EPEL Repo in CentOS 7

Step 2: Install yum-utils Tools

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

# yum install yum-utils
Install yum-utils in CentOS 7
Install yum-utils in CentOS 7

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

# yum install rpmconf
# rpmconf -a
Keep Default RPM Settings
Keep Default RPM Settings

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

# package-cleanup --leaves
# package-cleanup --orphans
Clean RPM Packages
Clean RPM Packages

Step 3: Install the dnf in CentOS 7

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

# yum install dnf
Install dnf in CentOS 7
Install dnf in CentOS 7

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

# dnf -y remove yum yum-metadata-parser
# rm -Rf /etc/yum
Remove Yum in CentOS 7
Remove Yum in CentOS 7

Step 4: Upgrading CentOS 7 to CentOS 8

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.

# dnf upgrade
Upgrade CentOS 7
Upgrade CentOS 7

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

# dnf install

Next, upgrade the EPEL repository.

dnf -y upgrade
Upgrade EPEL Repository
Upgrade EPEL Repository

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

# dnf clean all

Remove the old kernel core for CentOS 7.

# rpm -e `rpm -q kernel`

Next, be sure to remove conflicting packages.

# rpm -e --nodeps sysvinit-tools

Thereafter, launch the CentOS 8 system upgrade as shown.

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

Step 5: Install the New Kernel Core for CentOS 8

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

# dnf -y install kernel-core
Install Kernel in CentOS 8
Install Kernel in CentOS 8

Finally, install CentOS 8 minimal package.

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

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

# cat /etc/redhat-release
Check CentOS Version
Check CentOS Version

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


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

If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts? do ask for help in the comments section.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

131 thoughts on “How to Upgrade CentOS 7 to CentOS 8”

  1. At this step I got a fatal error:

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


    file /usr/lib/python3.6/site-packages/rpmconf/__pycache__/__init__.cpython-36.opt-1.pyc from install of python3-rpmconf-1.0.21-1.el8.noarch conflicts with file from package python36-rpmconf-1.0.22-1.el7.noarch

    So I just removed all the rpmconf packages:

    # rpm -evh rpmconf-1.0.22-1.el7.noarch
    # rpm -evh python36-rpmconf-1.0.22-1.el7.noarch
    # rpm -evh rpmconf-base-1.0.22-1.el7.noarch

    Then the upgrade action was successful, and I continued on. Maybe there is a better web page out there, but being careful in this process and backing up your data is always a good idea. The site did say not to perform on a production server.

    I then ran into errors executing this:

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

    but when I excluded yum it at least completed:

    # dnf -y groupupdate "Core" "Minimal Install" --exclude=yum

    At that stage I assumed given the kernel installed well, it needs a reboot to test whether it would be successful.

    The system came back-up and I installed a program to test dnf is working. Seems like it is.

  2. Thank you for this post. I got an error:

    sudo dnf -y –releasever=8 –allowerasing –setopt=deltarpm=false distro-sync
    [sudo] password for yjiang:
    CentOS-8 – Base 545 kB/s | 2.2 MB 00:04
    Remi’s PHP 7.2 RPM repository for Enterprise Linux 7 – x86_64 170 kB/s | 221 kB 00:01
    MySQL 8.0 Community Server 4.1 MB/s | 1.5 MB 00:00
    IUS for Enterprise Linux 7 – x86_64 1.7 MB/s | 624 kB 00:00
    MySQL Connectors Community 193 kB/s | 94 kB 00:00
    Safe Remi’s RPM repository for Enterprise Linux 7 – x86_64 615 kB/s | 2.3 MB 00:03
    CentOS-7 – SCLo sclo 496 kB/s | 1.1 MB 00:02
    geekery repository 0.0 B/s | 0 B 00:00
    CentOS-7 – SCLo rh 1.2 MB/s | 14 MB 00:11
    Extra Packages for Enterprise Linux 7 – x86_64 8.1 MB/s | 16 MB 00:02
    CentOS-8 – AppStream 1.8 MB/s | 5.8 MB 00:03
    MySQL Tools Community 505 kB/s | 553 kB 00:01
    CentOS-8 – Extras 43 kB/s | 8.1 kB 00:00
    Failed to synchronize cache for repo ‘geekery’, ignoring this repo.
    Problem: The operation would result in removing the following protected packages: kernel

  3. My Baremetal running centos7 started giving segmentation faulty post this. Lost all the data on the host. Please follow the procedure at your own risk.


Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.