How to Upgrade CentOS 7 to CentOS 8 Linux

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{centos-linux-repos-8-2.el8.noarch.rpm,centos-linux-release-8.4-1.2105.el8.noarch.rpm,centos-gpg-keys-8-2.el8.noarch.rpm}

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.

170 thoughts on “How to Upgrade CentOS 7 to CentOS 8 Linux”

  1. Moderate this comment, if you like: this web page, and a half-dozen like it helped me completely trash my Centos 7 system. Not a VM. A Real Box.

    Over 200 problems during dnf updates. From mundane to ridiculous. openssl, vim (VIM!), irreconcilable differences. Talk about bad advice.

    All to get to centos 8.x so I could run migrate the script to get on rocky Linux. Now I’m doing a bare install of rocky Linux, just like with every release of centos.

    Take this page down. You’re going to get more negative feedback if you don’t.

    • Bump. Why are people still trying this? More and more are reporting having a train wreck. Just don’t do it. I’m now running Rocky Linux, but it was not painless. There were differences between CentOS and RL. Just do the clean install. Good luck to you all.

  2. I had the same issue with mariadb. I removed mariadb, and now I end up with the following:

    Running transaction check
    Error: transaction check vs depsolve:
    (gcc >= 8 with gcc < 9) is needed by annobin-9.23-1.el8.ppc64le
    rpmlib(RichDependencies) <= 4.12.0-1 is needed by annobin-9.23-1.el8.ppc64le
    (annobin if gcc) is needed by redhat-rpm-config-123-1.el8.noarch
    rpmlib(RichDependencies) <= 4.12.0-1 is needed by redhat-rpm-config-123-1.el8.noarch

    There doesn't seem to be a way to fix this issue as far I can see as it appears to be an issue with the CentOS 8 repositories.

    • The follow-up to my own problem.

      Disabling the AppStream repo allowed me to upgrade, so the distro-sync process ran twice. Once with the appstream repo disabled (which did upgrade the system) and then a 2nd time (with appstream enabled) which ‘completed’ the upgrade process. I then ran a dnf upgrade to ensure everything upgraded okay.

      I had a bunch of orphaned el7 packages out there, so I did a quick ‘yum list | grep el7’ to identify them, and I removed those manually to prevent any future compatibility problems.

  3. Had to add “–allowerasing” to make mine work?

    # dnf install --allowerasing

    Also, change “upgrade” to “install“.

    # dnf -y upgrade
  4. I had the same problem and found a workaround:

    disable AppStream repo

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

    enable AppStream repo

    # dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync
    • Thanks for the fix here is the command I used to get it to work:

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

      After the installation, I also ran:

      # dnf update -y
      # dnf install kernel

      Everything looks good after the reboot now, thanks again.

  5. I have upgraded centos 7.9 to centos 8.3.2011,

    but it is still showing old kernel version.

    [[email protected] 18:12:48 boot]# uname -srv
    Linux 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017
    [[email protected] 18:13:04 boot]# rpm -qa | grep kernel | sort
  6. Alfista – You may see a section like “weak dependencies” that includes some of the packages that require these dependencies. Python3 and Perl stuff has to be removed.

  7. Hope to see the same guide for an upgrade from CentOS 7 to Rocky Linux 8 when will be available, this will save a lot of work in migration

    • @Luca,

      Sure, once Rocky Linux 8 available, if instructions are there to upgrade from CentOS to Rocky Linux, will surely publish the guide on same..

  8. Hi,

    I have a problem with transaction check:

    Running transaction check
    Error: transaction check vs depsolve:
    (gcc >= 8 with gcc < 9) is needed by annobin-9.23-1.el8.x86_64
    rpmlib(RichDependencies) = 3:10.3.27 if mariadb) is needed by mariadb-connector-c-3.1.11-2.el8_3.x86_64
    (mariadb-connector-c-config = 3.1.11-2.el8_3 if mariadb-connector-c-config) is needed by mariadb-connector-c-3.1.11-2.el8_3.x86_64
    rpmlib(RichDependencies) <= 4.12.0-1 is needed by mariadb-connector-c-3.1.11-2.el8_3.x86_64
    (annobin if gcc) is needed by redhat-rpm-config-123-1.el8.noarch
    rpmlib(RichDependencies) <= 4.12.0-1 is needed by redhat-rpm-config-123-1.el8.noarch
    To diagnose the problem, try running: 'rpm -Va –nofiles –nodigest'.
    You probably have corrupted RPMDB, running 'rpm –rebuilddb' might fix the issue.
    The downloaded packages were saved in cache until the next successful transaction.
    You can remove cached packages by executing 'dnf clean packages'.

    Please can you help me?



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.