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.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

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.

242 Comments

Leave a Reply
  1. Hi,

    I got this issue when trying to sync the package with Centos 8.

    # dnf --releasever=8 --setopt=deltarpm=false --setopt=protected_packages=  distro-sync -y
    
    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: 1:02:50 ago on Mon 04 Mar 2024 12:31:47 AM EST.
    Error: 
     Problem: problem with installed package libssh2-1.8.0-4.el7_9.1.aarch64
      - libssh2-1.8.0-4.el7_9.1.aarch64 does not belong to a distupgrade repository
      - nothing provides libcrypto.so.1.1()(64bit) needed by libssh2-1.10.0-1.el8.aarch64
      - nothing provides libcrypto.so.1.1(OPENSSL_1_1_0)(64bit) needed by libssh2-1.10.0-1.el8.aarch64
      - nothing provides libssl.so.1.1()(64bit) needed by libssh2-1.10.0-1.el8.aarch64
      - nothing provides libcrypto.so.1.1(OPENSSL_1_1_1)(64bit) needed by libssh2-1.10.0-1.el8.aarch64
    
    # dnf 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: 1:06:38 ago on Mon 04 Mar 2024 12:31:47 AM EST.
    Error: 
     Problem: problem with installed package libssh2-1.8.0-4.el7_9.1.aarch64
      - libssh2-1.8.0-4.el7_9.1.aarch64 does not belong to a distupgrade repository
      - nothing provides libcrypto.so.1.1()(64bit) needed by libssh2-1.10.0-1.el8.aarch64
      - nothing provides libcrypto.so.1.1(OPENSSL_1_1_0)(64bit) needed by libssh2-1.10.0-1.el8.aarch64
      - nothing provides libssl.so.1.1()(64bit) needed by libssh2-1.10.0-1.el8.aarch64
      - nothing provides libcrypto.so.1.1(OPENSSL_1_1_1)(64bit) needed by libssh2-1.10.0-1.el8.aarch64
    

    And when I tried to remove the package libssh2, this is what I got:

    # dnf remove libssh2
    
    Error: 
     Problem: The operation would result in removing the following protected packages: systemd
    

    Is there any ideas to fix this?

    Reply
    • @Thuy,

      You have libssh2-1.8.0-4.el7_9.1.aarch64 installed, which belongs to CentOS Linux 7 repository, which isn’t compatible with your CentOS 8 system.

      Updating it to the latest libssh2 version might fix the issue.

      sudo sudo dnf update
      sudo dnf update libssh2
      
      Reply
  2. Hi,

    Thanks for the guide. I’ve been doing distro upgrades since Redhat 7.3 to RedHat 9/RHEL 3 almost twenty years ago so I’m pretty well versed in these. However, I’ve ran into an issue after doing my first upgrade. dnf/yum runs out of memory when trying to do the epel repo (see below).

    This happens even if I raise the memory limit to 8GB of RAM and almost all of it is free.

    Do you know what is tripping this up? I’m sure its some limit setting somewhere.

    # dnf update
    
    AlmaLinux 8 - BaseOS                                                                                                         10 MB/s | 2.9 MB     00:00
    AlmaLinux 8 - AppStream                                                                                                      24 MB/s | 9.8 MB     00:00
    Out of memory allocating 16777216 bytes!
    Aborted (core dumped)
    
    Reply
  3. I have CentOS 7.9 and your guide for me fails at this point.

    [root@CentOS-73-64-minimal ~]# yum install -y leapp-upgrade leapp-data-almalinux

    –> Finished Dependency Resolution
    Error: Package: 1:leapp-upgrade-el7toel8-0.16.0-6.el7.elevate.17.noarch (elevate)
    Requires: python2-leapp
    Error: Package: 1:leapp-upgrade-el7toel8-deps-0.16.0-6.el7.elevate.17.noarch (elevate)
    Requires: python-requests
    Error: Package: 1:leapp-upgrade-el7toel8-deps-0.16.0-6.el7.elevate.17.noarch (elevate)
    Requires: dnf >= 4
    Error: Package: leapp-0.14.0-1.el7.noarch (elevate)
    Requires: python2-leapp = 0.14.0-1.el7
    Error: Package: 1:leapp-upgrade-el7toel8-0.16.0-6.el7.elevate.17.noarch (elevate)
    Requires: leapp-framework >= 2.2
    You could try using –skip-broken to work around the problem
    You could try running: rpm -Va –nofiles –nodigest

    Any idea to solve this ?

    Reply
    • @Graziano,

      The error message you’re encountering indicates that there are several unmet dependencies when trying to install the leapp-upgrade and leapp-data-almalinux packages.

      To fix this issue, you can follow below steps:

      1. Ensure your system is up to date:

      sudo yum update
      

      2. To satisfy the dependencies, you can try installing the required packages one by one:

      sudo yum install python2-leapp
      sudo yum install python-requests
      

      3. For the dnf >= 4 requirement, you may need to update or install DNF:

      sudo yum install dnf
      

      4. You can try installing leapp-framework with the specified version:

      sudo yum install leapp-framework-2.2
      

      5. After resolving these dependencies, try installing leapp-upgrade and leapp-data-almalinux again:

      sudo yum install -y leapp-upgrade leapp-data-almalinux
      

      If you encounter any additional dependency issues during this process, make sure to address them as well. If there are conflicts or issues that cannot be resolved, you may need to contact the package maintainers or the repository maintainers for assistance, as they might need to update their packages to resolve the dependencies.

      Reply
  4. 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
  5. 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
    • @Martin,

      It seems like you’re encountering an issue with the DNF package manager on CentOS 8, to fix this issue you can try the following steps:

      1. Update the DNF package to the latest version available in the repository.

      sudo dnf update dnf
      

      2. After updating DNF, try running the system update again.

      sudo dnf --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync
      

      If the issue persists, you may try reinstalling the ‘dnf’ package:

      sudo dnf reinstall dnf
      

      If the problem is related to dependencies, you may need to address those dependencies before attempting the update.

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

  8. 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
  9. 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
  10. @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
  11. Before yum install rpmconf do yum update, that will allow you to fix the issue with the error: import error: no module named _conf on step 3 ending.

    Reply
  12. Just FYI, I followed this blueprint to do an in-place upgrade from CentOS 8-Stream to 9-Stream. The biggest difference is that the CentOS 9-Stream mirrors are in a different place (you can find them on Mirror Manager). Otherwise, the above process worked pretty well and I had surprisingly few issues getting CentOS 9 up and running.

    Reply
  13. The command # dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync fails. It will try to remove the protected dnf package.

    Adding --setopt=protected_packages= is a really bad idea, because dnf is removed by itself.

    Then you have a system without dnf, yum, or rpm. Not recommended!

    Reply
  14. How to upgrade CentOS 7.9 to CentOS 8.5

    Type all the commands as root.

    # yum install epel-release -y
    # yum install yum-utils
    # yum install rpmconf
    # rpmconf -a
    

    Answer the questions using the default. Usuallly it is N, in httpd case it is Y.

    # package-cleanup --leaves
    # package-cleanup --orphans
    # yum install dnf
    # dnf -y remove yum yum-metadata-parser
    # rm -Rf /etc/yum
    # dnf upgrade
    # 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 --best --allowerasing
    # dnf clean all
    # rpm -e `rpm -q kernel`
    # rpm -e --nodeps sysvinit-tools
    # dnf remove kexec-tools
    # dnf remove ivtv-firmware
    # dnf remove linux-firmware
    # cd /root
    # wget http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/linux-firmware-20210702-103.gitd79c2677.el8.noarch.rpm
    # wget https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/kernel-4.18.0-348.el8.x86_64.rpm
    # wget https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/kernel-modules-4.18.0-348.el8.x86_64.rpm
    # wget https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/kernel-core-4.18.0-348.el8.x86_64.rpm
    # rpm -iv linux-firmware-20210702-103.gitd79c2677.el8.noarch.rpm
    # rpm -iv kernel-modules-4.18.0-348.el8.x86_64.rpm
    # cp /lib/modules/4.18.0-348.el8.x86_64/symvers.gz /boot/
    # cd /boot 
    # mv symvers.gz symvers-4.18.0-348.el8.x86_64.gz
    # cd /root
    # rpm -iv --replacepkgs kernel-core-4.18.0-348.el8.x86_64.rpm
    # rpm -iv kernel-4.18.0-348.el8.x86_64.rpm
    # cat /etc/redhat-release
    # reboot
    

    Check during the boot process is everything ok. Should be OK.

    # dnf check-update
    # dnf update nameofthepackage --best --allowerasing
    

    ———————– this is not fixed by me yet ———————————————
    libssh2.x86_64 – this is not possible to be upgraded just because the problem is that it will not let the dnf package be removed

    Dependencies described here:
    http://rpm.pbone.net/info_idpl_75792859_distro_redhatel8_com_libssh2-1.9.0-5.el8.x86_64.rpm.html

    Seems this is a huge dependencies issue, just because all those four libraries are not enough

    # wget https://download-ib01.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/l/libssh2-1.9.0-5.el8.x86_64.rpm
    # rpm -Uivh libssh2-1.9.0-5.el8.x86_64.rpm
    error: Failed dependencies:
            libcrypto.so.1.1()(64bit) is needed by libssh2-1.9.0-5.el8.x86_64
            libcrypto.so.1.1(OPENSSL_1_1_0)(64bit) is needed by libssh2-1.9.0-5.el8.x86_64
            libcrypto.so.1.1(OPENSSL_1_1_1)(64bit) is needed by libssh2-1.9.0-5.el8.x86_64
            libssl.so.1.1()(64bit) is needed by libssh2-1.9.0-5.el8.x86_64
    

    If you will try to download this one for CentOS 8 that contains all four libraries.

    # wget https://vault.centos.org/8.1.1911/BaseOS/x86_64/os/Packages/openssl-libs-1.1.1c-2.el8_1.1.x86_64.rpm
    

    And then if you will try to install it with this command:

    # rpm -iv openssl-libs-1.1.1c-2.el8_1.1.x86_64.rpm
    

    It will show these dependencies for example below. So a big surprise.

    crypto-policies >= 20180730 is needed by openssl-libs-1:1.1.1c-2.el8_1.1.x86_64

    So

    # wget https://vault.centos.org/8.5.2111/BaseOS/x86_64/kickstart/Packages/krb5-libs-1.18.2-14.el8.x86_64.rpm
    # rpm -iv krb5-libs-1.18.2-14.el8.x86_64.rpm
    
    warning: krb5-libs-1.18.2-14.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY
    error: Failed dependencies:
            /etc/crypto-policies/back-ends/krb5.config is needed by krb5-libs-1.18.2-14.el8.x86_64
            libc.so.6(GLIBC_2.25)(64bit) is needed by krb5-libs-1.18.2-14.el8.x86_64
            libc.so.6(GLIBC_2.27)(64bit) is needed by krb5-libs-1.18.2-14.el8.x86_64
            libcrypto.so.1.1()(64bit) is needed by krb5-libs-1.18.2-14.el8.x86_64
            libcrypto.so.1.1(OPENSSL_1_1_0)(64bit) is needed by krb5-libs-1.18.2-14.el8.x86_64
            libcrypto.so.1.1(OPENSSL_1_1_1b)(64bit) is needed by krb5-libs-1.18.2-14.el8.x86_64
            libssl.so.1.1()(64bit) is needed by krb5-libs-1.18.2-14.el8.x86_64
            libssl.so.1.1(OPENSSL_1_1_0)(64bit) is needed by krb5-libs-1.18.2-14.el8.x86_64
            openssl-libs >= 1:1.1.1c-4 is needed by krb5-libs-1.18.2-14.el8.x86_64
    

    Maybe it is possible to solve it by you know, checking which library has to be downloaded first and then downloading and installing them one by one in the correct order. Some day maybe will find out is it possible, but I am not sure.

    Reply
  15. Thereafter, launch the CentOS 8 system upgrade as shown.

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

    This will fail. So, instead of the above do the below without reboot:

    # dnf remove kexec-tools
    # dnf remove ivtv-firmware
    # dnf remove linux-firmware
    # cd /root
    # wget http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/linux-firmware-20210702-103.gitd79c2677.el8.noarch.rpm
    # wget https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/kernel-4.18.0-348.el8.x86_64.rpm
    # wget https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/kernel-modules-4.18.0-348.el8.x86_64.rpm
    # wget https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/kernel-core-4.18.0-348.el8.x86_64.rpm
    # rpm -iv linux-firmware-20210702-103.gitd79c2677.el8.noarch.rpm
    # rpm -iv kernel-modules-4.18.0-348.el8.x86_64.rpm
    # cp /lib/modules/4.18.0-348.el8.x86_64/symvers.gz /boot/
    # cd /boot 
    # mv symvers.gz symvers-4.18.0-348.el8.x86_64.gz
    # cd /root
    # rpm -iv --replacepkgs kernel-core-4.18.0-348.el8.x86_64.rpm
    # rpm -iv kernel-4.18.0-348.el8.x86_64.rpm
    # cat /etc/redhat-release
    # reboot
    

    Check during the boot process is everything ok. Should be.

    Reply
  16. Replace:
    # dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync
    with:

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

    Reply
  17. Running operation verification
    Error: operation verification vs depsolve:
    (NetworkManager >= 1.20 or dhclient) is needed by dracut-network-049-201.git20220131.el8.x86_64
    rpmlib(RichDependencies) <= 4.12.0-1 is needed by dracut-network-049-201.git20220131.el8.x86_64
    To detect the problem, try running: 'rpm -Va –nofiles –nodigest'.
    You probably have a corrupted RPMDB, running 'rpm –rebuilddb' might fix the problem.
    The downloaded packages have been cached for the next transaction.
    You can clear packages from cache by removing 'dnf clean packages'.

    Reply
  18. Unfortunately, the vault.centos.org repo for CentOS 8 is out, too.

    I just skipped CentOS entirely and From CentOS 7 I upgraded directly to CentOS 8 Stream using

    dnf install --allowerasing http://mirrors.advancedhosters.com/centos/8-stream/BaseOS/x86_64/os/Packages/{centos-stream-repos-8-3.el8.noarch.rpm,centos-stream-release-8.6-1.el8.noarch.rpm,centos-gpg-keys-8-3.el8.noarch.rpm}

    along with a few adjustments.

    Reply
      • Confirm it works with vault repos or with stream repos.

        Did upgrade with both repos.

        In some cases you can’t remove kernels from working OS, so you should boot into recovery mode and do it manually.

        1. Download kernel, kernel-core and kernel-modules, linux-firmware.

        wget https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/kernel-4.18.0-348.el8.x86_64.rpm
        wget https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/kernel-modules-4.18.0-348.el8.x86_64.rpm
        wget https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/kernel-core-4.18.0-348.el8.x86_64.rpm
        

        2. Boot in rescue mode and remove existing linux-firmware package and install downloaded package.

        dnf remove kexec-tools
        dnf remove ivtv-firmware
        dnf remove linux-firmware
        

        3. Then Install kernel packages by (rpm -iv kernel*).

        rpm -iv linux-firmware-20210702-103.gitd79c2677.el8.noarch.rpm
        rpm -iv kernel-modules-4.18.0-348.el8.x86_64.rpm
        /boot/symvers -> symlink /lib/moules/4.18…/symvers.gz
        rpm -iv --replacepkgs kernel-core-4.18.0-348.el8.x86_64.rpm
        rpm -e --nodeps sysvinit-tools
        rpm -q kernel-3.10.... (your kernels here)  and soft that depends on it
        

        5. Reboot.

        Reply
        • # rpm -iv linux-firmware-20210702-103.gitd79c2677.el8.noarch.rpm
          error: open of linux-firmware-20210702-103.gitd79c2677.el8.noarch.rpm failed: No such file or directory

          # rpm -iv kernel-modules-4.18.0-348.el8.x86_64.rpm
          error: Failed dependencies:
          kernel-uname-r = 4.18.0-348.el8.x86_64 is needed by kernel-modules-4.18.0-348.el8.x86_64

          # /boot/symvers -> symlink /lib/moules/4.18…/symvers.gz
          bash: /boot/symvers: No such file or directory

          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.