HOW TO: Remove old kernels in CentOS & RHEL

Removing older kernels in CentOS, RedHat Linux (RHEL), or Scientific Linux is really easy, if you know how!

Yum provides a package called “yum-utils” that provides a kernel cleanup utility. So you will need to install this package first.

Manually remove older kernels

Install yum-utils

Check which kernels you have installed:

Remove all but the oldest two kernels (you can change this number depending on how many kernels you wish to keep):


Optional: Automatically remove kernels in the future

You can also make it so that yum will automatically remove older kernels the next time you update your kernel.

Edit /etc/yum.conf:

Find the line ‘installonly_limit” and set it to 2 (or whichever number of kernels you wish to keep):

Comments

comments

Be the first to comment

Leave a Reply

Your email address will not be published.


*