November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Remove Old Kernels on RHEL, CentOS, Fedora

Remove Old Kernels on RHEL, CentOS, Fedora
This is quick guide howto delete/remove/clean old kernels on Fedora, CentOS, Red Hat (RHEL). I use here two kernel as example, if you want to keep other more or less, then adjust amount of installed kernels as you wish. Normally reason why you maybe want remove kernels is limited disk space, example on VPS servers and laptop. This is very easy task, you need yum-utils package.
1. Check Installed Kernels
Shell

rpm -q kernel
kernel-2.6.32-279.el6.x86_64
kernel-2.6.32-279.2.1.el6.x86_64
kernel-2.6.32-279.5.2.el6.x86_64
kernel-2.6.32-279.9.1.el6.x86_64

rpm -q kernel
kernel-2.6.32-279.el6.x86_64
kernel-2.6.32-279.2.1.el6.x86_64
kernel-2.6.32-279.5.2.el6.x86_64
kernel-2.6.32-279.9.1.el6.x86_64

2. Delete / Remove Old Kernels
Shell

## Install yum utils ##
yum install yum-utils

## Package-cleanup set count as how many old kernels you want left ##
package-cleanup –oldkernels –count=2

## Install yum utils ##
yum install yum-utils

## Package-cleanup set count as how many old kernels you want left ##
package-cleanup –oldkernels –count=2

3. Make Amount of Installed Kernels Permanent
Edit /etc/yum.conf and set installonly_limit:
Shell

installonly_limit=2

installonly_limit=2

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>