How to Remove Old Kernels

We can check Installed Kernels

root@serverxx [~]# rpm -q kernel
kernel-2.6.32-531.17.1.lve1.2.57.el6.x86_64
root@serverxx [~]# 

“yum list” to find out what kernels are installed. It can automatically perform system updates, removal of old packages etc

root@serverxx [~]# yum list kernel.*
Loaded plugins: fastestmirror, rhnplugin
Loading mirror speeds from cached hostfile
 * cloudlinux-x86_64-server-6: cl-mirror.qwords.net
Installed Packages
kernel.x86_64     2.6.32-531.17.1.lve1.2.57.el6      @cloudlinux-x86_64-server-6
Available Packages
kernel.x86_64     2.6.32-531.17.1.lve1.2.58.el6      cloudlinux-x86_64-server-6 
root@serverxx [~]# 

You can remove the older kernels by using

# yum remove kernel

Yum does not remove the kernel currently in use.

If you have enough space, keep atleast 2 kernels.

You can remove using exact kernel name,

yum remove

yum remove kernel-3.7.8-xx2.fc18.x86_64

You can see what kernel you’re using currently using the uname command

root@serverxx [~]# uname -r
2.6.32-531.17.1.lve1.2.57.el6.x86_64
root@serverxx [~]# 

or

root@serverxx [~]# uname -a
Linux serverxx.hosthat.com 2.6.32-531.17.1.lve1.2.57.el6.x86_64 #1 SMP Sat Jun 7 08:40:25 EDT xx14 x86_64 x86_64 x86_64 GNU/Linux
root@serverxx [~]# 

About Annie

I've been working in Technical Section for over 10 years in a wide range of tech jobs from Tech Support to Software Testing. I started writing blog for my future reference and useful for all.