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
Step 2: Install yum-utils Tools
After successfully installing EPEL, install yum-utils by running the command below.
# yum install yum-utils
Thereafter, you need to resolve RPM packages by executing the command.
# yum install rpmconf # rpmconf -a
Next, perform a clean-up of all the packages you don’t require.
# package-cleanup --leaves # package-cleanup --orphans
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
You also need to remove the yum package manager using the command.
# dnf -y remove yum yum-metadata-parser # rm -Rf /etc/yum
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
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.
Next, upgrade the EPEL repository.
dnf -y upgrade https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
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
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
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
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.
Hi,
I got this issue when trying to sync the package with Centos 8.
And when I tried to remove the package libssh2, this is what I got:
Is there any ideas to fix this?
@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.
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.
@Hal,
To view the minimum and recommended requirements, as well as the maximum limits supported by the releases, please refer to: https://access.redhat.com/articles/rhel-limits
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 ?
@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:
2. To satisfy the dependencies, you can try installing the required packages one by one:
3. For the dnf >= 4 requirement, you may need to update or install DNF:
4. You can try installing leapp-framework with the specified version:
5. After resolving these dependencies, try installing leapp-upgrade and leapp-data-almalinux again:
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.
Hello, I’m stuck in a several problems. Yum didn’t work. Dnf is not installed. All this problems happen before this step
There was a problem importing one of the Python modules required to run yum.
The error leading to this problem was:
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:
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………
@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.
For me, it ends like in the above comment:
I am also facing the same error while trying to upgrade CentOS 7 to CentOS 8.
@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.
2. After updating DNF, try running the system update again.
If the issue persists, you may try reinstalling the ‘dnf’ package:
If the problem is related to dependencies, you may need to address those dependencies before attempting the update.
I am stuck in this:
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
@Sunil,
Check your system timezone, date, and time, and set the time and date to the current date…
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.
Any help here
Thanks
Sunil
@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:
Hi Ravi, The server is in USA EST, so I set it to EST time.
Still getting the same error –
[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:
Hi Ravi, Still no luck
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…
Humm…
Be careful, some basic packages will be deleted with those steps of SSH service…
Regards
Hello,
Thanks for the instructions. It did seem easy enough to follow and worked well until:
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.
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.
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:
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:
Hopefully, this helps.
Hi,
I followed the procedure but at this stage:
I’m getting the error:
My kernel version after running command
uname -r
:Any idea appreciated.
@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…
@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:
@John,
Sorry for the trouble, but I think you can install those missing utilities with dnf tool after booting into CentOS 8…
Before
yum install rpmconf
doyum update
, that will allow you to fix the issue with the error: import error: no module named _conf on step 3 ending.Good evening how to create a virtual workstation with Ulteo under Centos 8?
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.
Could you please show what links and how you did it?
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!
How to upgrade CentOS 7.9 to CentOS 8.5
Type all the commands as root.
Answer the questions using the default. Usuallly it is N, in httpd case it is Y.
Check during the boot process is everything ok. Should be OK.
———————– 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
If you will try to download this one for CentOS 8 that contains all four libraries.
And then if you will try to install it with this command:
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
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.
Thereafter, launch the CentOS 8 system upgrade as shown.
This will fail. So, instead of the above do the below without reboot:
Check during the boot process is everything ok. Should be.
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
Tried that, but it removed dnf. Now the system is unusable.
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'.
Did not work for me.
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.
@Catalin,
I have updated the article and included the vault.centos.org repository…
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.
2. Boot in rescue mode and remove existing linux-firmware package and install downloaded package.
3. Then Install kernel packages by (rpm -iv kernel*).
5. Reboot.
# 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
-> error: open of linux-firmware-20210702-103.gitd79c2677.el8.noarch.rpm failed: No such file or directory – ! You don’t have it.
You should download it first.
And symlink here is just an example – you should write the full kernel name you have. Like:
/boot/symvers -> symlink /lib/moules/4.18.0-348.el8.x86_64/symvers.gz
I’m getting the same error when running:
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
When I ran the:
I got an error I noticed some other people got:
“Error:
Problem: The operation would result in removing the following protected packages: kernel”
How to get past the kernel-uname-r dependency error..?
@John,
Check these comments, hope it will solve your problem:
https://www.tecmint.com/upgrade-centos-7-to-centos-8/comment-page-11/#comment-1726257
https://www.tecmint.com/upgrade-centos-7-to-centos-8/comment-page-11/#comment-1726239
Seemed to work.