Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Login

Register Now

How to remove old kernels in Centos / RedHat

How to remove old kernels in 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

So, what do you think ? is this information useful? Let me know in comment section.

About Ranjan

Well my Name is Ranjan Chatterjee. An Electrical Engineer from Asansol , India. I am the founder of MeraHost and the one behind this blog too. Hostinglogy is a blog created to discuss some common problems regarding Web Hosting , server, domain etc...

Leave a reply