[Linux][CentOS] Boot Kernel quantity 修改

OS Version: CentOS 7.5.1804**

Grub2 Version: grub2-2.02-0.65

This is a command record for CentOS kernel, all the command come from internet reference.

List all available kernel images added to GRUB2

KernelQ_001

or use rpm to list all kernel

Change the number of kernel in two way

Temporary:

Note: If you get any duplicate RPMs in the local database, you can use the –cleandupes option to remove them.

The –oldkernels and –count options allows you to define the number of old kernels to keep.

Permanent:

You can find out the default number of kernel value is 5, you can change it to the number you want.

After you change the number, you can delete old kernet and reboot your system.

Change the Default Kernel Version Permanently on CentOS 7

You can find out the numeric value when you cat /boot/grub2/grub.cfg, the top one is 3.10.0-862.9.1 this numeric value is 0. So, if you want 3.10.0-693.2.2 become the default kernel you can do this:

After you insert or change the value, you need to regenerate grub config

Then reboot your system and you will see the kernel you selected.

Change the Default Kernel Version Permanently on CentOS 6 or earlier

Change the Default Boot Kernel Temporarily on CentOS

CentOS 7:

CentOS 6:

Reference

How to change default boot kernel permanently or temporarily on CentOS

RHEL7: How to set the number of old kernels kept.

Add a Comment