How to Reinstall the Deleted / Corrupted / Replaced GRUB2 Boot Loader on CentOS 7 / RHEL 7 / SL 7 / OL 7. The GRUB2 is the default boot loader for Enterprise Linux 7.  GRUB2 boot loader is the most important part of any Enterprise Linux. Most important thing it is used by millions. If the GRUB2 boot loader is Deleted / Corrupted / Replaced by any other OS then this guide provide you fix for this issues with ease. This tutorial shows the step by step methods that applies quickly and easily to fix this issue for your enterprise Linux.

How to Reinstall the GRUB2 Boot Loader on EL 7

Step-1 (Check the default location GRUB2 configuration files)
[root@techbrown ~]# rpm -qc grub2-tools
Sample Output
Step-2 (Remove the Default GRUB2 configuration file)
[root@techbrown ~]# rm -rf /etc/default/grub
Step-3 (Remove the grub2-tools configuration files)
[root@techbrown ~]# rm -rf /etc/grub.d/*
Step-4 (Reinstall the GRUB2 using yum command)
[root@techbrown ~]# yum reinstall grub2-tools
Step-5 (Regenerate and save the GRUB2 configuration file)
[root@techbrown ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Sample Output
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-229.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-229.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-7e890c03ebb940a9a67163adaef14894
Found initrd image: /boot/initramfs-0-rescue-7e890c03ebb940a9a67163adaef14894.img

Final Words

That’s all finally you have fixed and reinstalled the damaged / corrupted GRUB2 boot loader using the above steps. If you have issues regarding this topic then you have to use the comment section below.