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
# dnf install
# 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 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.

James Kiarie

This is James, a certified Linux administrator and a tech enthusiast who loves keeping in touch with emerging trends in the tech world. When I'm not running commands on the terminal, I'm taking listening to some cool music. taking a casual stroll or watching a nice movie.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide
The Complete Linux System Administrator Bundle
Become an Ethical Hacker Bonus Bundle

You may also like...

70 Responses

  1. Adnan Harb says:

    I have a segmentation fault ins response to “dnf -y remove yum yum-metadata-parser .

    What could be the solution?

  2. Cartes says:


    I’m really at a loss about a weird problem after “rebooting”. I find that my network config is messed up. The 1st NIC eth0 is now renamed en1sp0, and the network config is not respecting the ifcfg-enp1s0 file.

    [[email protected] ~]# ifconfig
    enp1s0: flags=4163  mtu 1500
            inet  netmask  broadcast
            inet6 fe80::1e1b:dff:fe73:465d  prefixlen 64  scopeid 0x20

    Whereas, the ifcfg-enp1s0 says:


    I just couldn’t get it to respect these settings at all! I read many articles, which said that NetworkManager now controls these settings, but everything says it respects the ifcfg files in /etc/sysconfig/network-scripts.

    So, can anyone help how the /32 address is coming up?

  3. Cartes says:


    My Centos 7 install fails at the “dnf install” lines under Step 4:

    [[email protected] ~]# dnf install
    Last metadata expiration check: 0:01:17 ago on Mon 30 Mar 2020 01:11:24 AM +06.
    centos-repos-8.1-1.1911.0.8.el8.x86_64.rpm 17 kB/s | 12 kB 00:00
    Problem: conflicting requests
    - nothing provides centos-gpg-keys = 8.1-1.1911.0.8.el8 needed by centos-repos-8.1-1.1911.0.8.el8.x86_64
    - nothing provides system-release = 8.1 needed by centos-repos-8.1-1.1911.0.8.el8.x86_64
    [[email protected] ~]# dnf install
    Last metadata expiration check: 0:01:37 ago on Mon 30 Mar 2020 01:11:24 AM +06.
    centos-release-8.1-1.1911.0.8.el8.x86_64.rpm 25 kB/s | 21 kB 00:00
    Problem: conflicting requests
    - 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
    [[email protected] ~]# dnf install
    Last metadata expiration check: 0:01:47 ago on Mon 30 Mar 2020 01:11:24 AM +06.
    centos-gpg-keys-8.1-1.1911.0.8.el8.noarch.rpm 41 kB/s | 11 kB 00:00
    Problem: problem with installed package centos-release-7-7.1908.0.el7.centos.x86_64
    - package centos-gpg-keys-8.1-1.1911.0.8.el8.noarch conflicts with centos-release < 8.0-0.1905.0.10 provided by centos-release-7-7.1908.0.el7.centos.x86_64
    - conflicting requests
    (try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages)

    The previous command ran perfectly:
    [[email protected] ~]# dnf upgrade
    Extra Packages for Enterprise Linux 7 - x86_64 5.9 MB/s | 16 MB 00:02
    Docker main Repository 32 kB/s | 28 kB 00:00
    CentOS-7 - Base 5.1 MB/s | 10 MB 00:02
    CentOS-7 - Updates 4.6 MB/s | 9.4 MB 00:02
    CentOS-7 - Extras 80 kB/s | 259 kB 00:03
    Dependencies resolved.
    Nothing to do.

    What could be going wrong?

    • Cartes says:

      Solved it! The comment from “bartmantv” was really helpful!

      I stumbled upon another error that was solved by the “MonkeyPet” solution!

      Thank you, everyone!

  4. Duilio says:

    I’m trying to upgrade centos, but I’m having problems after

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

    Error: transaction check vs depsolve:
    (gcc >= 8 with gcc < 9) is needed by annobin-8.78-1.el8.x86_64
    rpmlib(RichDependencies) <= 4.12.0-1 is needed by annobin-8.78-1.el8.x86_64
    (annobin if gcc) is needed by redhat-rpm-config-120-1.el8.noarch
    rpmlib(RichDependencies) <= 4.12.0-1 is needed by redhat-rpm-config-120-1.el8.noarch
    To diagnose the problem, try running: 'rpm -Va –nofiles –nodigest'.

    I tried:

    # dnf remove redhat-rpm-config

    and also removed the package with issues in:

    #  rpm -Va --nofiles --nodigest

    and after that I did.

    # rpm --rebuilddb

    But, the same problem.


    # dnf clean packages

    Tried again:

    # dnf remove redhat-rpm-config     

    and got:
    No match for argument: redhat-rpm-config
    No packages marked for removal.

    Tried also

    # dnf remove redhat-rpm-config-120-1.el8.noarch

    but still the same problem.

    Any help with what is the problem?

  5. Leo says:

    It’s pretty good, with minor flaws though:

    Firstly, I ran into difficulty remove kernel rpm because I’m using vdo support. You have to remove that.

    Then too, you must install all 3 centos-release/repos/keys rpm in one command since they are dependency loop, old school headache.

    There are lots of transactions fail during ‘dnf upgrade‘ but basically because I’m using some 3rd party repos and I can fix that later.

    Thanks anyway, it’s a good one.

  6. forbiddenera says:

    Okay, it magically came back after I couldn’t even ssh, was dumping a random error. Came back to shell and I was able to fix the rest

    still sketchy..! backup first / no production!

  7. Antxon says:

    Even if the process might work, it is not a tested procedure by Red Hat. Why not use Leapp, which is what Red Hat supports?

  8. MonkeyPet says:

    If you get into dependencies hell try:

    # dnf install gdbm gdbm-libs --best --allowerasing
  9. bartmantv says:

    I just did this myself had to modify the rpm installation step, this needs to be a single install command including all the files

    So instead of this step:

    # dnf install
    # dnf install
    # dnf install

    anonymous previously on Feb 7 stated this, so your update was close, it has to be one line for dependencies to work. I’ve escaped the newline so it can formatted for webpage use…

    # dnf install \ \

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

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