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.

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

  1. Other correction on step4:

    # rpm -e `rpm -q kernel`
    

    if you will received an error like:

    kernel(wait_for_completion) = 0x6d0aba34 is needed by (installed) kmod-kvdo-6.1.3.7-5.el7.x86_64
    kernel(wait_for_completion_interruptible) = 0x015ddbdc is needed by (installed) kmod-kvdo-6.1.3.7-5.el7.x86_64
    kernel(wake_up_process) = 0xe65cdceb is needed by (installed) kmod-kvdo-6.1.3.7-5.el7.x86_64
    kernel(yield) = 0x760a0f4f is needed by (installed) kmod-kvdo-6.1.3.7-5.el7.x86_64

    you need to remove this packages in order to proceed further:

    # rpm -e kmod-kvdo vdo
    
    Reply
  2. This upgrade works with some little corrections:

    Step 4
    =====

    # dnf install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-repos-8.1-1.1911.0.8.el8.x86_64.rpm
    # dnf install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-release-8.1-1.1911.0.8.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
    

    should be executed as one command line and with the updated links to avoid errors.

    For example:

    # 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

    Reply
  3. Ugh! I wish I had read these comments before I followed these instructions and destroyed my Centos 7 installation. What exactly is the point of posting these instructions?

    Reply
    • @John,

      We clearly stated that: The steps described herein do not depict the official upgrade and this should not be applied to a production server yet.

      Reply
    • @VP,

      We clearly stated in the beginning “The steps described herein do not depict the official upgrade and this should not be applied to a production server yet.”

      Reply
      • Thank you for responding @Ravi.

        I want to mention that I always get wonderful articles and steps in TecMint site for a lot of tasks and it’s very useful for me and for all who are looking for the same.

        Regarding this article, obviously I did not perform the steps on the production server. I had read your instructions on the top. And I think no one would directly implement such sort of work directly on the production server. It did not work for the test environment either.

        Many have given some corrections and other helpful links in the comment. I followed them also but still, the test didn’t complete successfully.

        Maybe it had worked earlier but I think no longer now.

        But thanks for giving me a good option to try.

        Regards.

        Reply
    • Is working.

      The only problem I got conflict with some python packages in time of upgrade after the command:

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

      Simple remove conflict package:

      # dnf remove python36-rpmconf-1.0.22-1.el7.noarch
      

      and repeat:

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

      Next thing was network interfaces renamed and badly configured ( old “eth” -> new “ens”) – in this case, “nmtui” is Your friend

      Thanks Ravi for your great tutorial

      Reply
  4. I upgraded my CentOS kernel 7 to 8, but some packages didn’t.

    I tried:

    # dnf install mod_http2
    

    and I get an error:

    Error: Transaction check error:
    file /usr/share/pixmaps/poweredby.png from install of centos-logos-httpd-80.5-2.el8.noarch conflicts with file from package centos-logos-70.0.6-3.el7.centos.noarch

    Then I wanted to remove the old package:

    # rpm -e centos-logos-70.0.6-3.el7.centos.noarch
    

    Guess what:

    error: Failed dependencies:
    system-logos >= 7.92.1-1 is needed by (installed) httpd-2.4.6-90.el7.centos.x86_64
    system-logos is needed by (installed) plymouth-0.8.9-0.32.20140113.el7.centos.x86_64

    When I wanted to know about those packages:

    # rpm -qi httpd
    ...
    Release     : 90.el7.centos
    

    and

    # rpm -qi plymouth
    ...
    Release     : 0.32.20140113.el7.centos
    

    I am stuck!

    I would appreciate any help.

    Reply
    • You have to finish last dnf transaction, try to upgrade the system (--nobest, --skip-broken, etc) or remove all duplicates at once (dnf repoquery --duplicates).

      Reply
  5. I’m also stuck on Step #4 but a little further down at “Thereafter, launch the CentOS 8 system upgrade as shown”:

    [[email protected] ~]# dnf -y –releasever=8 –allowerasing –setopt=deltarpm=false distro-sync
    Repository extras is listed more than once in the configuration
    Repository centosplus is listed more than once in the configuration
    CentOS-8 – Base 0.0 B/s | 0 B 00:00
    CentOS-8 – Updates 0.0 B/s | 0 B 00:00
    CentOS-8 – Extras 0.0 B/s | 0 B 00:00
    Failed to synchronize cache for repo ‘base’, ignoring this repo.
    Failed to synchronize cache for repo ‘updates’, ignoring this repo.
    Failed to synchronize cache for repo ‘extras’, ignoring this repo.
    Last metadata expiration check: 0:02:16 ago on Tue 21 Apr 2020 06:56:57 AM UTC.
    Error:
    Problem: The operation would result in removing the following protected packages: dnf, systemd

    Obviously, I don’t want to get rid of dnf or systemd. I’m digging around but thought I’d check if anyone has run into this. There’s also the “Failed to synchronize cache for repo” warning but I’ll look into that later.

    Reply
    • The given command is not complete. You need to add the minor version too (8.1)

      # dnf -y --releasever=8.1 --allowerasing --setopt=deltarpm=false distro-sync
      
      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.