Centos / RedHat 6.x: Delete / Remove Old Kernels

0

After a while of updating kernels on my box, I spotted on a reboot that I kinda have loads of kernel versions on the boot menu, cause i never cleaned up.

So here we go. Remove old unused kernel versions from CentOS or RedHat 6.x

Check installed kernels

rpm -q kernel

Delete/remove old kernels

yum install yum-utils
package-cleanup --oldkernels --count=2                #replace the count with the maximum of wished kernels to remain

To make this count permanent:

Edit /etc/yum.conf and set installonly_limit from 5 to whatever you like to:

installonly_limit=2

Usefull commands:

rpm -qa Display list all installed packages rpm -qa
rpm -qa | less

Leave a Reply