Browsing posts in: yum

How to remove old kernels – Centos / RedHat

If you’ve got limited space on your /boot partition and want to tidy things up by removing old kernels, it’s really easy –

First you need to install yum-utilities –

yum install yum-utils

Now you can just use the “package-cleanup” command and it will do all the work for you –

package-cleanup --oldkernels --count=2

Notice at the end of the command line “–count=2” – in this example, I’ve told it to leave the most recent 2 kernels in place. You can just as easily change this to whatever (non-zero!) number of kernels you prefer to leave in place on your /boot partition.

If you prefer for yum to manage this for you, you can set a limit in /etc/yum.conf –

installonly_limit=2

Setting that value inside yum.conf will have yum automatically delete older kernels when installing new ones to keep your limit to the desired number.

If you ever want to view the current kernel version you are running, just use the following –

uname -r

If you want see all kernels on your system, you can use –

rpm -q kernel