Page 1 of 1

What's the best way to delete old linux kernel on CentOS 6

Posted: Tue Oct 25, 2016 2:00 pm
by Ashlin
What's the best way to delete old linux kernel on CentOS 6 ?

Re: What's the best way to delete old linux kernel on CentOS 6

Posted: Tue Oct 25, 2016 6:03 pm
by Aaron
Hello Ashlin,

You can safely remove the unneeded kernels, but always try to keep at least a couple of old kernels to fall back to if there is a problem with an update.

To check Current kernel version

# uname -a
Linux serv.example.com 2.6.32-358.23.2.el6.x86_64 #1 SMP Wed Oct 16 18:37:12 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux


To check All kernel versions installed

# rpm -qa | grep kernel
kernel-smp-2.6.9-42.EL
kernel-smp-2.6.9-42.0.3.EL
kernel-smp-2.6.9-42.0.8.EL

To remove old kernel

#rpm -e kernel-smp-2.6.9-42.EL

There is another safe way to manually remove unneeded kernels is by using yum.
First use "yum list" to find out what kernels are installed:

#yum list kernel.*
kernel-smp-2.6.9-42.EL
kernel-smp-2.6.9-42.0.3.EL
kernel-smp-2.6.9-42.0.8.EL

#yum remove kernel-smp-2.6.9-42.EL

Also you can keep fewer kernels automatically by editing /etc/yum.conf and change the value installonly_limit=3, so the yum update will keep only latest 3 kernels.