The kernel package in Linux distros is not tied to the userland which means you're free to install as many kernels as you want and boot into any of them.
So, forget about "upgrading" and "downgrading". Think about "installing" and "removing" kernel packages.
If you want to install mainline stable kernels in CentOS please enable this repo: https://elrepo.org/tiki/kernel-ml
Answer from Artem S. Tashkinov on Stack ExchangeThe kernel package in Linux distros is not tied to the userland which means you're free to install as many kernels as you want and boot into any of them.
So, forget about "upgrading" and "downgrading". Think about "installing" and "removing" kernel packages.
If you want to install mainline stable kernels in CentOS please enable this repo: https://elrepo.org/tiki/kernel-ml
This would list the available versions:
dnf --showduplicates search kernel | grep kernel-5
Which at least lists the last few versions (local and remote):
kernel-5.14.0-427.18.1.el9_4.x86_64 : The Linux kernel
kernel-5.14.0-427.20.1.el9_4.x86_64 : The Linux kernel
kernel-5.14.0-427.22.1.el9_4.x86_64 : The Linux kernel
kernel-5.14.0-427.22.1.el9_4.x86_64 : The Linux kernel
Which then can be installed and chosen from, at boot-time:
sudo dnf install kernel-5.14.0-427.18.1.el9_4.x86_64
It all depends which packages the RPM repository has even available:
sudo dnf downgrade kernel-5.14.0-427.22.1.el9_4.x86_64
Package kernel of lowest version already installed, cannot downgrade it.
In this case, one can only use local *.rpm (eg, from BaseOS, AppStream) to downgrade:
sudo dnf install \
~/Downloads/kernel-5.14.0-427.16.1.el9_4.x86_64.rpm \
~/Downloads/kernel-core-5.14.0-427.16.1.el9_4.x86_64.rpm \
~/Downloads/kernel-modules-5.14.0-427.16.1.el9_4.x86_64.rpm \
~/Downloads/kernel-modules-core-5.14.0-427.16.1.el9_4.x86_64.rpm \
~/Downloads/kernel-devel-5.14.0-427.16.1.el9_4.x86_64.rpm \
~/Downloads/kernel-devel-matched-5.14.0-427.16.1.el9_4.x86_64.rpm \
~/Downloads/kernel-headers-5.14.0-427.16.1.el9_4.x86_64.rpm
Important: One has to install the whole bunch at once.
Another caveat may be, that installonly_limit in /etc/dnf/dnf.conf may get in the way.
On CentOS, just substitute dnf with yum.
Actually, downgrade wouldn't work for kernel. The right command would be localinstall:
#yum localinstall ./kernel....rpm
If you have more then 5 kernels yum will delete oldest.
rpm -ivh <kernel.rpm> --oldpackage
does the job in centos
This will install your kernel, now make sure the grub entries are proper and then you can reboot and boot into this kernal
Downgrade kernel in CentOS from 3.10.0-862.3.3 to 3.10.0-693.5.2, how to resolve missing dependencies? - Unix & Linux Stack Exchange
install centos older kernel version - Unix & Linux Stack Exchange
Downgrade kernel version with yum
Can I roll back the kernel from 8.1 back to the one that was shipped in 8.0? Should I?
Yes you can... should you is a different story.
yum downgrade kernel
Should do it.
More on reddit.comRed Hat Enterprise Linux 6.4 is just Red Hat Enterprise Linux 6.0 with all updates rolled into it. "Downgrading" would mean going to 5.x. If something isn't "certified" for RHEL 6.4 it's just lagging behind, or perhaps it is incompatible with a specific update (if so, I'd be rather suspicious of a package that breaks with Red Hat's very conservative package update policy).
RedHat says the correct solution is to install the appropriate kernel version, then downgrade to the previous minor release:
How to downgrade kernel and redhat-release to a previous minor version of Red Hat Enterprise Linux
https://access.redhat.com/solutions/186763
# yum list kernel-2.6.32-358*
...
kernel.x86_64 2.6.32-358.23.2.el6 rhel-6.2-server-for-rhs-2.0-rpms
# yum install kernel-2.6.32-358.23.2.el6
# Reboot
# yum downgrade redhat-release
Confirm the downgrade:
# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.4 (Santiago)
You are on the right track. You just didn't specify the kernel version the way yum expects it. The correct command would be
yum install kernel-2.6.18-128.8.1.el5
(Note that kernel packages are not updates for each other, each of them is a separate install, and the old ones remain until you run "rpm -e".)
One thing to try would be to freeze your redhat-release level, I'm not sure if this would prevent you from moving to a kernel newer than 2.6.18-128.8.1.el5, but it would prevent your release from being updated to 5.4
How can I keep the RHEL version static (e.g. RHEL 5.1)? See answer by Dennis Williamson
Ouch. The update to 8.1 broke a third-party kernel module that had been running fine in 8.0, but apparently is incompatible with the 4.18.0-147.3.1.el8_1.x86_64 kernel. The developer distributes the kernel module via an .rpm that installs to DKMS.
Is it possible in 8.1 to roll back to the kernel from 8.0? Is that advisable?