How to Remove Old Linux Kernel from Linux Server

If you have the different versions of Linux kernel installed on your server and you are using only the latest one and  want to remove the old, unused kernel’s on server. Follow the below steps to remove the old kernels.

First use the below command to check the currently used kernel version on server. So that u can keep live one and delete others.

uname -a

Now use the below rpm command to list out the installed kernels on server. The output clearly show’s list of kernels available on servers. I can see that i’m using the last kernel which is displayed below. And i want to remove rest of the two from server those are outdated.

[email protected] [~]# rpm -q kernel
kernel-2.6.32-504.1.3.el6.x86_64
kernel-2.6.32-431.23.3.el6.x86_64
kernel-2.6.32-573.8.1.el6.x86_64
kernel-2.6.32-431.20.3.el6.x86_64
kernel-2.6.32-604.30.3.lve1.3.63.el6.x86_64

Use the below rpm command to remove the old kernels on server:

rpm -e kernel-2.6.32-504.1.3.el6.x86_64
rpm -e kernel-2.6.32-431.23.3.el6.x86_64
rpm -e kernel-2.6.32-573.8.1.el6.x86_64
rpm -e kernel-2.6.32-431.20.3.el6.x86_64

Once done again you can confirm whether the old kernel’s are removed or not.

rpm -q kernel

The output will clearly shows you that only latest kernel is available on server.

Please stay tune with us…

Leave a Reply