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 -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
Install CentOS 8 Release

Install CentOS 8 Release

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 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

You may also like...

28 Responses

  1. Paul I Lin says:

    Hi James,

    Thanks for this awesome write-up. It’s refreshing to see this even though https://centos.org/forums/viewtopic.php?t=71848 mentioned such a script is not possible. I’m hitting a bit of a problem with the step where I’m supposed to “launch the CentOS 8 system upgrade as shown.” executing:

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

    After executing that line, I’m met with the following output:

    “`
    Last metadata expiration check: 0:24:37 ago on Mon 18 Nov 2019 11:56:09 AM CST.
    Error:
    Problem: The operation would result in removing the following protected packages: kernel
    “`

    • Paul I Lin says:

      I eventually got past this as I realized when I was executing “rpm -e `rpm -q kernel`” I actually had some errors so that didn’t pass. Getting past these errors got me past my problems.

  2. Paul Lin says:
    $ sudo dnf --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync
    

    Last metadata expiration check: 0:03:51 ago on Mon 18 Nov 2019 11:56:09 AM CST.
    Error:
    Problem: The operation would result in removing the following protected packages: kernel

  3. Nigel Aves says:

    I get to this stage of the process “# dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync“, and nothing happens. Doing this it immediately gives system prompt, no message.

    Followed every step very precisely. The one that caused grief was “rpm -e `rpm -q kernel`” – reported programs that needed the kernel, but I was expecting to clean up “old kernels” later, so did not worry too much about it. See typical messages at the end of a note.

    Also. When I ran the “rpmconf -a” command, I never saw the “2nd question”. After answering "n" to the first, I jumped straight to the system prompt.

    This was my 2nd attempt.

    Fresh install loaded Centos 7 >> Server with GUI – minimal install.

    Loaded Webmin / Virtualmin for LAMP system (does not yet support Centos 8, hence the Centos 7 route).

    Then run through all steps in the guide, until…

    Regards – Nigel Aves

    rpm -e `rpm -q kernel`
    error: Failed dependencies:
    kernel >= 3.10.0-384.el7 is needed by (installed) hypervvssd-0-0.34.20180415git.el7.x86_64
    kernel >= 3.10.0-384.el7 is needed by (installed) hypervfcopyd-0-0.34.20180415git.el7.x86_64
    kernel >= 3.10.0-384.el7 is needed by (installed) hypervkvpd-0-0.34.20180415git.el7.x86_64
    kernel >= 3.10.0-1025.el7 is needed by (installed) kmod-kvdo-6.1.2.41-5.el7.x86_64
    kernel >= 2.6.32 is needed by (installed) lldpad-1.0.1-5.git036e314.el7.x86_64
    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

    and on and on and on !! …… pages and pages of this type of error.

  4. Milan Keršláger says:

    Even “dnf update” works, there is an error:

    dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync
    CentOS-8 – Base 0.0 B/s | 0 B 00:00
    CentOS-8 – Updates 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.
    Last metadata expiration check: 0:07:33 ago on Sat Nov 16 09:53:12 2019.
    Error:
    Problem: The operation would result in removing the following protected packages: dnf

  5. TheFlipside says:

    Excellent tutorial, just a few remarks:

    – For me, it was necessary to remove some packages which are not available on the new release, in this example in particular “bash-completion-extras” which just doesn’t exist in the release 8 and prevented the DNF upgrade to be able to work.

    – It should also be stated that before you finally apply the upgrade to the new release you should check carefully which packages will be removed without replacement because again, some don’t exist in the new release and therefore will just be gone.

    In my example, the “transmission” packages were gone because they are neither offered by the base repos nor epel.

    – Also interesting to know, if some SELinux settings had been altered prior to the system upgrade, these will be gone and need to be set again after the upgrade.

    For example allowing the sshd daemon to listen on a different port:

    # semanage port -a -t ssh_port_t -p tcp 2222
    
  6. Marcinek says:

    This part:
    rpm -e `rpm -q kernel`
    fails. I get hundreds of dependency errors and nothing gets erased. And then the next step fails with the message:
    Problem: The operation would result in removing the following protected packages: kernel

  7. mtx77 says:

    Other than 2 minor non-stopping errors (dnf -y install kernel-core told me it was already updated and dnf groupupdate of core told me it couldn’t find the package yum) the upgrade went fine.

    Great guide!

  8. Kyle says:

    I ran into an issue during this upgrade path.

    I could not update gdbm.

    https://bugzilla.redhat.com/show_bug.cgi?id=1562170

  9. Linux Jes says:

    Hi: I need help for this error

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

    • Ravi Saive says:

      @Linux,

      Have you followed all the instructions correctly? what command does give the error message? I request you to follow the instructions again carefully….

    • VV says:

      Encountered the _same_ error.

      I advise you to run “rpm -Va --nofiles --nodigest” and see what it shows, then remove as said in the article all conflict RPMs with dnf (“dnf remove pkg_name“). In the end “rpm --rebuilddb” for sure.

      Then run “dnf check” – look at problems and remove another portion of packages mentioned from the report (same “dnf remove package_name“).

      I’ve removed: dnf remove redhat-rpm-config.noarch && dnf remove microcode_ctl && dnf remove initscripts && dnf remove rpm-build
      this is not the full list, and maybe there are some differs in pkg names.

      Take them all from the outputs above.

  10. Aman Sharma says:

    Hello Mr. Ravi, I have tested all the given steps and successfully upgraded Centos 7 to 8. Thanks for this blog.

    • Ravi Saive says:

      @Aman,

      That really good to know, we have tested the Centos 7 to 8 upgrade process in 2-3 servers to make sure that the upgrade process is error-free.

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.