How to Upgrade CentOS 7 to CentOS 8 Linux

In this article, you will learn how to upgrade CentOS 7 to CentOS 8.5 release. 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 resolve 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 the 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://vault.centos.org/8.5.2111/BaseOS/x86_64/os/Packages/{centos-linux-repos-8-3.el8.noarch.rpm,centos-linux-release-8.5-1.2111.el8.noarch.rpm,centos-gpg-keys-8-3.el8.noarch.rpm}

Note: CentOS 8 is dead and all the repos have been moved to vault.centos.org.

Install CentOS 8 Release Packages
Install CentOS 8 Release Packages

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`
Remove Old CentOS 7 Kernel
Remove Old CentOS 7 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

Note: If you get errors about conflicting packages, for example in my case there were conflicts about the existing python36-rpmconf package. I removed this package, similarly if you get any conflicts just remove those packages and try running the above upgrade command.

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

If you see the above output, I have successfully upgraded from CentOS 7 to CentOS 8.5 release.

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 read this far, tweet to the author to show them you care. Tweet a thanks
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.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

234 thoughts on “How to Upgrade CentOS 7 to CentOS 8 Linux”

  1. Hello, I’m stuck in a several problems. Yum didn’t work. Dnf is not installed. All this problems happen before this step

    # dnf install http://vault.centos.org/8.5.2111/BaseOS/x86_64/os/Packages/{centos-linux-repos-8-3.el8.noarch.rpm,centos-linux-release-8.5-1.2111.el8.noarch.rpm,centos-gpg-keys-8-3.el8.noarch.rpm}
    

    There was a problem importing one of the Python modules required to run yum.

    The error leading to this problem was:

    /usr/lib64/python2.7/site-packages/pycurl.so: undefined symbol: CRYPTO_num_locks
    

    Please install a package which provides this module, or verify that the module is installed correctly.

    It’s possible that the above module doesn’t match the current version of Python, which is:

    2.7.5 (default, Jun 20 2023, 11:36:40) 
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
    

    If you cannot solve this problem yourself, please go to the yum faq at: http://yum.baseurl.org/wiki/Faq

    Maybe is time to say goodbye to centos………

    Reply
    • @Pablo,

      The error message you mentioned indicates that there is an issue with the pycurl module in your Python installation, which appears that there is a missing or incompatible symbol related to OpenSSL’s CRYPTO_num_locks function.

      Try reinstalling the pycurl (python-pycurl) module to ensure that you have the latest version that is compatible with your updated OpenSSL.

      # yum install python-pycurl
      OR
      # dnf install python-pycurl
      
      Reply
  2. For me, it ends like in the above comment:

    # dnf --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync
    CentOS Linux 8 - BaseOS                                                                                      
    CentOS Linux 8 - AppStream    
    Failed to synchronize cache for repo 'baseos', ignoring this repo.
    Failed to synchronize cache for repo 'appstream', ignoring this repo.
    Last metadata expiration check: 0:01:07 ago on 2023-01-15T13:39:04 UTC.
    Error: 
     Problem: The operation would result in removing the following protected packages: dnf
    
    Reply
  3. I am stuck in this:

    (700/701): ntfs-3g-2022.10.3-1.el8.x86_64.rpm                    459 kB/s | 133 kB     00:00
    (701/701): ntfsprogs-2022.10.3-1.el8.x86_64.rpm                  1.2 MB/s | 404 kB     00:00
    -----------------------------------------------------------------------------------------------
    Total                                                            649 kB/s | 724 kB     00:01
    Running transaction check
    Error: transaction check vs depsolve:
    (gcc >= 8 with gcc < 9) is needed by annobin-9.72-1.el8_5.2.x86_64
    rpmlib(RichDependencies) <= 4.12.0-1 is needed by annobin-9.72-1.el8_5.2.x86_64
    (annobin if gcc) is needed by redhat-rpm-config-125-1.el8.noarch
    rpmlib(RichDependencies) <= 4.12.0-1 is needed by redhat-rpm-config-125-1.el8.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
  4. Hi Ravi, I am having issues when I try to – Next, install CentOS 8 release package using dnf as shown below. This will take a while.


    # dnf install http://vault.centos.org/8.5.2111/BaseOS/x86_64/os/Packages/{centos-linux-repos-8-3.el8.noarch.rpm,centos-linux-release-8.5-1.2111.el8.noarch.rpm,centos-gpg-keys-8-3.el8.noarch.rpm}
    CentOS-7 - Base 0.0 B/s | 0 B 00:00
    CentOS-7 - Updates 0.0 B/s | 0 B 00:00
    CentOS-7 - 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:01:24 ago on Thu 02 Feb 2023 04:42:15 PM UTC.
    [MIRROR] centos-linux-repos-8-3.el8.noarch.rpm: Curl error (56): Failure when receiving data from the peer for http://vault.centos.org/8.5.2111/BaseOS/x86_64/os/Packages/centos-linux-repos-8-3.el8.noarch.rpm [Recv failure: Connection reset by peer]
    [FAILED] centos-linux-repos-8-3.el8.noarch.rpm: Curl error (56): Failure when receiving data from the peer for http://vault.centos.org/8.5.2111/BaseOS/x86_64/os/Packages/centos-linux-repos-8-3.el8.noarch.rpm [Recv failure: Connection reset by peer]
    Curl error (56): Failure when receiving data from the peer for http://vault.centos.org/8.5.2111/BaseOS/x86_64/os/Packages/centos-linux-repos-8-3.el8.noarch.rpm [Recv failure: Connection reset by peer]

    Any suggestions/thoughts?

    Thanks
    Sunil

    Reply
      • Thanks, Ravi!

        Changed the time and time zone. Now I am unable to remove the old kernel and also unable to upgrade the kernel version.

        $  rpm -e `rpm -q kernel`
        
        error: Failed dependencies:
                kernel >= 2.6.32 is needed by (installed) lldpad-1.0.1-7.git036e314.el7_9.x86_64
                kernel >= 2.6.32 is needed by (installed) lldpad-1.0.1-7.git036e314.el7_9.x86_64
        
        [root]# dnf -y install kernel-core
        CentOS-7 - Base                                                                                                              
        CentOS-7 - Updates                                                                                                       
        CentOS-7 - Extras                                                                                                        
        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:01:55 ago on Mon 06 Feb 2023 11:54:47 AM EST.
        No match for argument: kernel-core
        Error: Unable to find a match: kernel-core
        

        Any help here
        Thanks
        Sunil

        Reply
        • @Sunil,

          There could be three reasons for getting a such error:

          1. Incorrect date and time settings
          2. Old dnf cache expired
          3. CentOS baseURL

          Fix these issues by:

          # timedatectl set-timezone "Asia/Kolkata"
          # dnf install http://vault.centos.org/8.5.2111/BaseOS/x86_64/os/Packages/{centos-linux-repos-8-3.el8.noarch.rpm,centos-linux-release-8.5-1.2111.el8.noarch.rpm,centos-gpg-keys-8-3.el8.noarch.rpm}
          # dnf -y upgrade https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
          # dnf clean all
          # rpm -e `rpm -q kernel`
          
          Reply
          • Hi Ravi, The server is in USA EST, so I set it to EST time.

            Still getting the same error –

            [root@~]# date
            Tue Feb  7 10:06:07 EST 2023
            


            [root@c~]# dnf install http://vault.centos.org/8.5.2111/BaseOS/x86_64/os/Packages/{centos-linux-repos-8-3.el8.noarch.rpm,centos-linux-release-8.5-1.2111.el8.noarch.rpm,centos-gpg-keys-8-3.el8.noarch.rpm}
            CentOS-7 - Base 0.0 B/s | 0 B 00:00
            CentOS-7 - Updates 0.0 B/s | 0 B 00:00
            CentOS-7 - 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: 22:11:40 ago on Mon 06 Feb 2023 11:54:47 AM EST.
            [MIRROR] centos-linux-repos-8-3.el8.noarch.rpm: Curl error (56): Failure when receiving data from the peer for http://vault.centos.org/8.5.2111/BaseOS/x86_64/os/Packages/centos-linux-repos-8-3.el8.noarch.rpm [Recv failure: Connection reset by peer]
            [FAILED] centos-linux-repos-8-3.el8.noarch.rpm: Curl error (56): Failure when receiving data from the peer for http://vault.centos.org/8.5.2111/BaseOS/x86_64/os/Packages/centos-linux-repos-8-3.el8.noarch.rpm [Recv failure: Connection reset by peer]
            Curl error (56): Failure when receiving data from the peer for http://vault.centos.org/8.5.2111/BaseOS/x86_64/os/Packages/centos-linux-repos-8-3.el8.noarch.rpm [Recv failure: Connection reset by peer]

          • @Sunil,

            It seems your curl doesn’t support SSL/TLS properly. Try to update or upgrade your system with:

            $ dnf update
            $ dnf upgrade
            
          • Hi Ravi, Still no luck

            [root@INDPCS ~]# dnf update
            CentOS-7 - Base                                 0.0  B/s |   0  B     00:00
            CentOS-7 - Updates                              0.0  B/s |   0  B     00:00
            CentOS-7 - 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: 16:13:48 ago on Tue 07 Feb 2023 04:02:13 PM EST.
            Dependencies resolved.
            Nothing to do.
            Complete!
            
            [root@INDPCS ~]# dnf upgrade
            CentOS-7 - Base                                 0.0  B/s |   0  B     00:00
            CentOS-7 - Updates                              0.0  B/s |   0  B     00:00
            CentOS-7 - 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: 16:14:10 ago on Tue 07 Feb 2023 04:02:13 PM EST.
            Dependencies resolved.
            Nothing to do.
            

            Complete!
            [root@INDPCS ~]#

          • @Sunil,

            It looks like your repos are empty, I suggest you check the repos in /etc/yum.repos.d/ directory and see the sizes of the base, updates, and extras repository. Also, I suggest your to try to follow the instructions again from the beginning…

  5. Hello,

    Thanks for the instructions. It did seem easy enough to follow and worked well until:

    # dnf --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync
    CentOS Linux 8 - BaseOS                                                                                      
    CentOS Linux 8 - AppStream    
    Failed to synchronize cache for repo 'baseos', ignoring this repo.
    Failed to synchronize cache for repo 'appstream', ignoring this repo.
    Last metadata expiration check: 0:01:07 ago on 2023-01-15T13:39:04 UTC.
    Error: 
     Problem: The operation would result in removing the following protected packages: dnf
    

    Google then took me to either irrelevant or highly complex and problematic pages… I’m going to revert my snapshot for maybe another try later.

    Reply
    • Uninstall dnf from the centos7 install before starting. Centos7 dnf uses python2, when following the process above the installation of dnf in order should pull a python3 version for you.

      Reply
    • I had the same issue and kept trying different things.

      The solution I found was to search for the newest repositories from the CentOS 8 Stream and use this when installing the CentOS 8 repos:

      # dnf install http://http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/{centos-stream-repos-8-6.el8.noarch.rpm,centos-stream-release-8.6-1.el8.noarch.rpm,centos-gpg-keys-8-6.el8.noarch.rpm}
      

      After removing the old kernel I needed to remove the old python-pip package since this will conflict with other packages moving forward.

      Then I manually installed “NetworkManager” before executing:

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

      Hopefully, this helps.

      Reply
  6. Hi,

    I followed the procedure but at this stage:

    # dnf -y install kernel-core
    

    I’m getting the error:

    No match for argument: kernel-core
    Error: Unable to find a match: kernel-core.
    

    My kernel version after running command uname -r:

    3.10.0-957.el7.x86_64
    

    Any idea appreciated.

    Reply
    • @Cyrus,

      To fix this problem you need to boot into rescue mode, then remove the existing linux-firmware package and then manually download and install kernel, kernel-core, and kernel-modules, linux-firmware using rpm -ivh kernel* command.

      After that reboot the machine…

      Reply
  7. @Ravi Saive,

    Works with that long sequence. I am somehow able to rpm -ivh kernel-modules after removing a lot of packages related to python3 maybe. Able to show and boot into Centos 8. But since I was deep with a lot of packages in CentOs 7, after doing a lot of dnf removal.

    I ended up missing some crucial utilities after booting into CentOS 8. Ended up just reinstalling a CentOS 8. Was never able to run:

    # dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync
    
    Reply
    • @John,

      Sorry for the trouble, but I think you can install those missing utilities with dnf tool after booting into CentOS 8…

      Reply

Got something to say? Join the discussion.

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.