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

Discussions related with hosting control panels used, which include cPanel, Plesk, Directadmin etc..
Post Reply
Ashlin
Posts: 0
Joined: Fri Sep 16, 2016 10:10 am

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

Post by Ashlin »

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



Aaron
Posts: 17
Joined: Mon Apr 11, 2016 8:59 am

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

Post 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.


Aaron N
Linux Support Engineer.
Nixtree Solutions LLP
Managed Full Server Backups
https://www.nixtree.com/managed-backups.php

Follow us on : https://twitter.com/nixtree

Post Reply