Hi i am Ashish, having 12 Yr's of experience in IT field. Worked on some of the most known OS distro's of Linux like RHEL/CentOS, Virtualization (VMware vSphere ESXi 5.x and 6.x), Docker as well as on storage like EMC VNX/VMAX and HPE 3PAR.
Here on this forum i'll share some of my good experiences with you all, Hope this will help you ...
Compile and install latest kernel from source on RHEL or CentOS 7 OS ...
In this blog i will show you, how you can compile and install latest kernel from source on RHEL 7 Or CentOS 7 Operating system.
Check currently installed kernel version :
# uname -r
As you can see current kernel version is 3.10, but i want to upgrade it to the latest stable available version, which you can find on https://www.kernel.org/ official website. As of today current stable available version is "5.0.5"
To download this "5.0.5" kernel source, you can click either the big Yellow download button or you can click on the "tarball" link as shown in above screenshot. You can also download this version from below link:
What if GRUB is corrupted on your RHEL or CentOS 7 ?
GRUB corruption is a common problem in RHEL or CentOS, which could occur due these reasons:
If any file is missing or deleted from "/boot/grub2/" folder e.g. "grub.cfg"
Mistakenly ran "dd" utility to clear boot sector
Due to bad sector or corrupted disk
Bad or incompatible firmware/driver installation e.t.c.
In case GRUB is corrupted, usually after powering on your server you see below kind of shell, also known as GRUB shell:
Once you get to this prompt there is a way to restore or recover GRUB so that your system can boot up properly. To recover GRUB we need to have RHEL or CentOS 7 ISO image, which we usually use for OS installation. Make sure you mount same OS version iso image which is already installed on system. Below procedure will work only on BIOS based X86 servers and virtual machines.
Follow these steps to recover GRUB:
Step 1 : Mount RHEL or CentOS 7 ISO image on your physical server and boot from it. In case you are using HPE Prolient server you can mount this ISO image on iLO, if this is virtual environment then mount it accordingly and reboot server or VM from ISO. Once rebooted you will see below options:
Step 2 : Scroll down and select "Troubleshooting" option from menu and PRESS "Enter"
Step 3 : Select "Rescue a CentOS system" and press ENTER:
Step 4 : Press ENTER key again to continue:
Step 5 : To continue, Type "1" and press ENTER, this will bring you to rescue mode, chroot sysimage filesystem using below command:
# chroot /mnt/sysimage
Step 6 : Next step is to install GRUB2 on the boot disk this will be usually "/dev/sda":
# grub2-install /dev/sda
On this step you should not see any error. In case "grub2-install" command is not available then you will have to install it through "grub2-tools" package which can be found in ISO image.
Step 7 : Once GRUB2 is installed, next step is to generate "grub.cfg" in "/boot/grub2" directory.
# grub2-mkconfig -o /boot/grub2/grub.cfg
File is generated, you can check as shown in above screenshot.
Once done, exit from the chroot and again exit to reboot the server.