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 http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-repos-8.2-2.2004.0.1.el8.x86_64.rpm http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-release-8.2-2.2004.0.1.el8.x86_64.rpm http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-gpg-keys-8.2-2.2004.0.1.el8.noarch.rpm

Next, upgrade the EPEL repository.

dnf -y upgrade https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
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

Conclusion

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.

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

    • I’m glad the guide worked. We are trying to get to the bottom of the matter on other cases where the installation didn’t go quite well as expected.

      Reply
  1. This tutorial doesn’t work. Upgrading from the latest 7 series (7.7.1908) ends up with the aforementioned error by other people.

    Error: transaction check vs depsolve:
    (annobin if gcc) is needed by redhat-rpm-config-116-1.el8.0.1.noarch
    rpmlib(RichDependencies) <= 4.12.0-1 is needed by redhat-rpm-config-116-1.el8.0.1.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'.

    I'm an experienced sysadmin, btw… This shouldn't be Google's the first result frankly…

    Reply
    • Solution: dnf -y --exclude=annobin --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync

      Next problem: conflicting packages. Solution: Removing all packages with conflicts (many in my install!)

      Reply
      • This got me through.. I also had to exclude lib webp.

        We will have to manually fix those conflicts after but yeah… I think I finally got through

        messy

        Reply
  2. I’ve tried the steps twice now (clean install) and when I get to this stage I always get the following error. (Steps to duplicate at the end, I have to load Virtualmin on Centos 7 as it does not yet support RH Enterprise or Centos 8)

    At this stage of the process…

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

    Running transaction check
    Error: transaction check vs depsolve:
    (annobin if gcc) is needed by redhat-rpm-config-116-1.el8.0.1.noarch
    rpmlib(RichDependencies) <= 4.12.0-1 is needed by redhat-rpm-config-116-1.el8.0.1.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'.

    (none of the " suggested fixes" work)

    Steps to reproduce.

    Centos7 – load minimal server.
    Centos7 – load minimal desktop (loading sequence at end)
    Centos7 – Grab Virtualmin install script and run the install
    login to virtualmin (https://localhost:10000) and finish installation.

    Now follow the above steps in this tutorial to upgrade.

    Here's how I installed the desktop.

    # yum groupinstall “X Window System”
    # yum install gnome-classic-session gnome-terminal nautilus-open-terminal control-center liberation-mono-fonts firefox
    # unlink /etc/systemd/system/default. target.
    # ln -sf /lib/systemd/system/graphical. target /etc/systemd/system/default. target.
    # reboot
    
    Reply
  3. Hello,

    I am running into an error when running the actual upgrade command.

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


    Running transaction check
    Error: transaction check vs depsolve:
    (annobin if gcc) is needed by redhat-rpm-config-116-1.el8.0.1.noarch
    rpmlib(RichDependencies) = 2.87-5 is needed by (installed) initscripts-9.49.47-1.el7.x86_64
    Unsatisfied dependencies for iprutils-2.4.17.1-2.el7.x86_64:
    /sbin/pidof is needed by (installed) iprutils-2.4.17.1-2.el7.x86_64

    The “rpm –rebuilddb” command was not helpful.

    Any idea what to do next?

    Thanks,
    Joseph

    Reply
    • Actually, this is the series of commands and responses (what was pasted into my first note missed a few details):


      Running transaction check
      Error: transaction check vs depsolve:
      (annobin if gcc) is needed by redhat-rpm-config-116-1.el8.0.1.noarch
      rpmlib(RichDependencies) = 2.87-5 is needed by (installed) initscripts-9.49.47-1.el7.x86_64
      Unsatisfied dependencies for iprutils-2.4.17.1-2.el7.x86_64:
      /sbin/pidof is needed by (installed) iprutils-2.4.17.1-2.el7.x86_64

      Reply
    • I had the same error with “(annobin if gcc)” and “rpmlib(RichDependencies)“. No amount of uninstalling packages/rpms etc would clear it.

      I ended up giving up and restoring my filesystems back to just before I started the update.

      (yes, my first step was to take a backup of my filesystems . . . . )

      Reply
        • @Adrian,

          I have tested the same upgrade instructions on my CentOS 7.7, it did work for me without any error and I managed to upgrade it to CentOS 8.

          We are testing again with other CentOS 7.x versions, we will keep you posted…

          Reply
    • @Zaur,

      Use dnf command, instead yum, as dnf is the default package manager of RHEL 8. If you still want to use yum command, just install it:

      # dnf install yum
      
      Reply
  4. Ran into an issue…

    When I rebooted after doing this upgrade the system didn’t come up properly and I couldn’t log in at the console as the password was not being authenticated. This turned out to be because CentOS 7 hadn’t been using SELinux and CentOS 8 was by default but the filesystem hadn’t been labeled.

    The easy fix was to “touch /.autorelabel” and reboot (thank ${DEITY} for dracut emergency shell!). Probably worth adding that touch command to your instructions just to be safe.

    Reply
  5. Thanks for the nice article. One question: How should I expand the instructions considering that in my Centos 7 install I have the following repositories active?

    repo id repo name
    Webmin Webmin Distribution Neutral
    base/7/x86_64 CentOS-7 – Base
    epel/x86_64 Extra Packages for Enterprise Linux 7 – x86_64
    extras/7/x86_64 CentOS-7 – Extras
    updates/7/x86_64 CentOS-7 – Updates

    Thanks in advance

    Reply
      • Thant’s not right. I was able to proceed with the upgrade while having REMI Repo active after I upgraded REMI rpm to EL8. Otherwise upgrading EPEL repo is not possible. I think, there might be more issues with other repos.

        Reply
  6. I got the following error message when I run the command below.
    [[email protected] ~]# rpm -e `rpm -q kernel`
    error: Failed dependencies:
    kernel(PDE_DATA) = 0x44f0d59d is needed by (installed) kmod-kvdo-6.1.2.41-5.el7.x86_64
    kernel(___ratelimit) = 0x155f4108 is needed by (installed) kmod-kvdo-6.1.2.41-5.el7.x86_64
    kernel(__bitmap_weight) = 0x4cbbd171 is needed by (installed) kmod-kvdo-6.1.2.41-5.el7.x86_64
    kernel(__cond_resched_lock) = 0xe2cfb038 is needed by (installed) kmod-kvdo-6.1.2.41-5.el7.x86_64
    kernel(__init_waitqueue_head) = 0xf432dd3d is needed by (installed) kmod-kvdo-6.1.2.41-5.el7.x86_64
    kernel(__list_add) = 0x0343a1a8 is needed by (installed) kmod-kvdo-6.1.2.41-5.el7.x86_64
    kernel(__list_del_entry) = 0x65e75cb6 is needed by (installed) kmod-kvdo-6.1.2.41-5.el7.x86_64
    kernel(__mutex_init) = 0x9a025cd5 is needed by (installed) kmod-kvdo-6.1.2.41-5.el7.x86_64

    Reply

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.