Clean up old kernels

This is quick guide howto delete/remove/clean old kernels on Fedora, CentOS, Red Hat (RHEL). I use here two kernel as example, if you want to keep other more or less, then adjust amount of installed kernels as you wish. Normally reason why you maybe want remove kernels is limited disk space, example on VPS servers and laptop. This is very easy task, you need yum-utils package.
Check Installed Kernels

rpm -q kernel

Remove Old Kernels

Enter following command to remove old kernel:

## Install yum utils ##
yum install yum-utils
## Package-cleanup set count as how many old kernels you want left ##
package-cleanup --oldkernels --count=2

Make Amount of Installed Kernels Permanent

Edit /etc/yum.conf and set installonly_limit:


Wael Isa