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.

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

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

    It doesn’t seem to upgrade the el7 RPMs to the el8 versions. Now that 8.1 is out, is the repos setup for that upgrade is conflicting with the upgrade process?

    I tried
    dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false upgrade

    But that didn’t work either. Now the system will download a whole bunch of RPMs and not install them.

    Wonder if I go to the repo files and hard code the path to the 8.0 repo if it would at least get me to that release then the 8.1 can take over from there.

    Reply
  2. To fix the “rpmlib(RichDependencies) <= 4.12.0-1&quot; problem you need newer rpm on CentOS 7.

    Upgrade the packages "rpm", "rpm-libs", "rpm-plugin-selinux", "python2-rpm" from: https://cbs.centos.org/kojifiles/packages/rpm/4.13.0.2/1.el7.c8/x86_64/

    Reply
  3. change the step

    # dnf -y upgrade http://mirror.bytemark.co.uk/centos/8/BaseOS/x86_64/os/Packages/centos-release-8.0-0.1905.0.9.el8.x86_64.rpm

    as per:

    # dnf install http://less.cogeco.net/CentOS/8/BaseOS/x86_64/os/Packages/centos-repos-8.1-1.1911.0.8.el8.x86_64.rpm
    # http://less.cogeco.net/CentOS/8/BaseOS/x86_64/os/Packages/centos-release-8.1-1.1911.0.8.el8.x86_64.rpm
    # http://less.cogeco.net/CentOS/8/BaseOS/x86_64/os/Packages/centos-gpg-keys-8.1-1.1911.0.8.el8.noarch.rpm

    Reply
  4. Thanks, but it doesn’t work, at the moment the new release is centos-release-8.1-1.1911.0.8.el8.x86_64.rpm. The upgrade just stop

    [[email protected] ~]# cat /etc/centos-release
    CentOS Linux release 7.7.1908 (Core)
    

    [[email protected] ~]# dnf -y upgrade http://mirror.bytemark.co.uk/centos/8/BaseOS/x86_64/os/Packages/centos-release-8.1-1.1911.0.8.el8.x86_64.rpm
    Last metadata expiration check: 1:33:06 ago on Sun 26 Jan 2020 12:15:03 PM CET.
    centos-release-8.1-1.1911.0.8.el8.x86_64.rpm 78 kB/s | 21 kB 00:00
    Dependencies resolved.

    Problem: cannot install the best update candidate for package centos-release-7-7.1908.0.el7.centos.x86_64
    - nothing provides centos-gpg-keys = 8.1-1.1911.0.8.el8 needed by centos-release-8.1-1.1911.0.8.el8.x86_64
    - nothing provides centos-repos = 8.1-1.1911.0.8.el8 needed by centos-release-8.1-1.1911.0.8.el8.x86_64
    ========================================================================================================================================================================
    Package Arch Version Repository Size
    ========================================================================================================================================================================
    Skipping packages with broken dependencies:
    centos-release x86_64 8.1-1.1911.0.8.el8 @commandline 21 k

    Transaction Summary
    ========================================================================================================================================================================
    Skip 1 Package

    Nothing to do.
    Complete!
    [[email protected] ~]#
    [[email protected] ~]#

    [[email protected] ~]# rpm -ivh http://mirror.bytemark.co.uk/centos/8/BaseOS/x86_64/os/Packages/centos-gpg-keys-8.1-1.1911.0.8.el8.noarch.rpm
    Retrieving http://mirror.bytemark.co.uk/centos/8/BaseOS/x86_64/os/Packages/centos-gpg-keys-8.1-1.1911.0.8.el8.noarch.rpm
    warning: /var/tmp/rpm-tmp.futBz3: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY
    error: Failed dependencies:
    centos-release < 8.0-0.1905.0.10 conflicts with centos-gpg-keys-8.1-1.1911.0.8.el8.noarch
    [[email protected] ~]#

    Reply
    • Try to do things in the following order:

      dnf -y upgrade http://mirror.bytemark.co.uk/centos/8.0.1905/BaseOS/x86_64/os/Packages/centos-release-8.0-0.1905.0.9.el8.x86_64.rpm
      dnf install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-gpg-keys-8.1 -1.1911.0.8.el8.noarch.rpm

      This should be enough to install and upgrade all the necessary packages

      Reply
    • You need to issue the command in one single line:

      dnf install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-repos-8.1-1.1911.0.9.el8.x86_64.rpm http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-release-8.1-1.1911.0.9.el8.x86_64.rpm http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-gpg-keys-8.1-1.1911.0.9.el8.noarch.rpm

      Reply
  5. Need to use dnf -y upgrade http://mirror.bytemark.co.uk/centos/8.0.1905/BaseOS/x86_64/os/Packages/centos-release-8.0-0.1905.0.9.el8.x86_64.rpm as 8.1 is out.

    Reply
  6. Please help:

    dnf upgrade shows this error:

    Error: Transaction check error:
    file /usr/lib64/libgdbm_compat.so.4.0.0 from install of gdbm-libs-1:1.18-1.el8.x86_64 conflicts with file from package gdbm-1.10-8.el7.x86_64

    Thanks! ASAP.

    Reply
  7. So I completed your guide to upgrading CentOS 7 to 8 after fixing the issue I mentioned earlier. But after I rebooted, I only see the CentOS 7 boot loader and none of the boot loaders can boot because CentOS 7 is gone. I can still boot into rescue mode – is there a way to edit the boot screen to pick up the new CentOS 8 boot loader?

    Reply
  8. Total mess – Do not do it

    I just stuck in it. nor you can update with DNF or any way to reinstall yum again.!!!

    can not run any program like this:
    /usr/sbin/squid: symbol lookup error: /usr/sbin/squid: undefined symbol: _ZN7libecap4NameC1ERKNSt7__cxx1112basi...IcESaIcEE

    Last metadata expiration check: 0:11:25 ago on Thu 26 Dec 2019 07:49:40 PM +0330.
    Error:
    Problem: package python3-dnf-4.0.9.2-5.el8.noarch requires dnf-data = 4.0.9.2-5.el8, but none of the providers can be installed
    – package dnf-4.0.9.2-5.el8.noarch requires python3-dnf = 4.0.9.2-5.el8, but none of the providers can be installed
    – cannot install both dnf-data-4.0.9.2-5.el8.noarch and dnf-data-4.0.9.2-1.el7_6.noarch
    – package yum-4.0.9.2-5.el8.noarch requires dnf = 4.0.9.2-5.el8, but none of the providers can be installed
    – package python2-dnf-4.0.9.2-1.el7_6.noarch requires dnf-data = 4.0.9.2-1.el7_6, but none of the providers can be installed
    – conflicting requests
    – problem with installed package python2-dnf-4.0.9.2-1.el7_6.noarch
    (try to add ‘–allowerasing’ to command line to replace conflicting packages or ‘–skip-broken’ to skip uninstallable packages)

    Reply
  9. 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'.

    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.