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.

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

  1. I managed to upgrade two of my servers, but was unable to update the majority of my servers and simply had to reinstall (rebuild them). This is the main command that I used for the servers I managed to upgrade using the above process.

    dnf upgrade -y http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/{centos-release-8.1-1.1911.0.8.el8.x86_64.rpm,centos-gpg-keys-8.1-1.1911.0.8.el8.noarch.rpm,centos-repos-8.1-1.1911.0.8.el8.x86_64.rpm.

    I also found MonkeyPet’s contribution to dependency hell very useful.

    Here is a reminder

    # dnf install gdbm gdbm-libs --best --allowerasing
    

    Now for the real stinger.

    Even after navigating the following problem dependency problem with the aid of MonkeyPet’s suggestion

    Error: transaction check vs depsolve:
    (gcc >= 8 with gcc < 9) is needed by annobin-8.78-1.el8.x86_64
    

    my servers upgraded but crashed on boot up because their local storage controllers could not be recognized (you just get an infinite hang on boot uploading the newly upgraded kernels). The reason why is because a large number of storage controller drivers were removed from the RHEL8.x and hence Centos 8.x base kernel during RHEL 8.x development.

    This affects a number of common workhorses Entry and Medium Level servers some of which were on sale 3 years ago (e.g. Dell R210, R510, R710). See the list of deprecated drivers here;

    https://elrepo.org/linux/dud/el8/x86_64

    The drivers can only be installed as part of the Driver Update Disk (DUD) process during a reinstall, so this rules out upgrading from Centos7 to Centos8 for a fair number of servers. Take heed.

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

    What could be the solution?

    Reply
  3. Hi,

    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 192.168.1.63  netmask 255.255.255.255  broadcast 192.168.1.63
            inet6 fe80::1e1b:dff:fe73:465d  prefixlen 64  scopeid 0x20
    

    Whereas, the ifcfg-enp1s0 says:

    TYPE=Ethernet
    BOOTPROTO=none
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=yes
    IPV6INIT=yes
    IPV6_AUTOCONF=no
    IPV6_DEFROUTE=no
    IPV6_FAILURE_FATAL=no
    NAME=enp1s0
    DEVICE=enp1s0
    ONBOOT=yes
    IPADDR=192.168.1.63
    #SUBNET=255.255.255.0
    PREFIX=24
    GATEWAY=192.168.1.64
    DNS1=8.8.8.8
    DNS2=8.8.4.4
    IPV6_PEERDNS=yes
    IPV6_PEERROUTES=yes
    

    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?

    Reply
  4. Hi,

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

    [[email protected] ~]# 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
    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
    Error:
    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 http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-release-8.1-1.1911.0.8.el8.x86_64.rpm
    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
    Error:
    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 http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-gpg-keys-8.1-1.1911.0.8.el8.noarch.rpm
    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
    Error:
    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.
    Complete!

    What could be going wrong?

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

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

      Thank you, everyone!

      Reply
  5. 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.

    Tried:

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

    Reply
  6. 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.

    Reply
  7. 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!

    Reply
  8. 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?

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

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

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.