Removing older kernels in CentOS, RedHat Linux (RHEL), or Scientific Linux is really easy, if you know how!
Yum provides a package called “yum-utils” that provides a kernel cleanup utility. So you will need to install this package first.
Manually remove older kernels
sudo install yum-utils
Check which kernels you have installed:
rpm -q kernel
Remove all but the oldest two kernels (you can change this number depending on how many kernels you wish to keep):
package-cleanup --oldkernels --count=2
Optional: Automatically remove kernels in the future
You can also make it so that yum will automatically remove older kernels the next time you update your kernel.
Find the line ‘installonly_limit” and set it to 2 (or whichever number of kernels you wish to keep):
Leave a Reply