How to change the default kernel in GRUB for RHEL and CentOS


How to change the default kernel in  GRUB for CentOS 7 and  RHEL 7 servers?

 

OS Version: RHEL and  CentOS 7

Step 1: Get installed  kernel versions

# awk -F\' /^menuentry/{print\$2} /etc/grub2.cfg
0- Red Hat Enterprise Linux Server (3.10.0-1062.7.1.el7.x86_64) 7.7 (Maipo)
1- Red Hat Enterprise Linux Server (3.10.0-1062.1.2.el7.x86_64) 7.7 (Maipo)
2- Red Hat Enterprise Linux Server (3.10.0-693.el7.x86_64) 7.4 (Maipo)
3- Red Hat Enterprise Linux Server (0-rescue-39228403a82a4e29afb7e5ca1a869adb) 7.4 (Maipo)

Step 2: Use grub2-set-default command

#grub2-set-default 1

Step 3: Check grubenv  file

# cat /boot/grub2/grubenv |grep saved
saved_entry=1

Step 4: Rebuild Grub.cfg file

BIOS-Based:
#ls  -ld  /boot/grub2/grub.cfg
-rw-r--r--. 1 root root 6083 Dec  3 15:55 /boot/grub2/grub.cfg
#grub2-mkconfig -o /boot/grub2/grub.cfg

UEFI-BASED:
#ls  -ld  /boot/efi/EFI/redhat/grub.cfg
#grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

Step 5: Restart Server

#shutdown  -r  now

 

I'm a IT Infrastructure and Operations Architect with extensive experience and administration skills and works for Interbank Card Center Of Turkey(BKM). I provide hardware and software support for the IT Infrastructure and Operations tasks.

195 Total Posts
Follow Me

0 Comments

Leave a Reply