Posts

Showing posts from March, 2019

Compiling and installing latest kernel from source on RHEL or CentOS 7

Image
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 3.10.0-957.el7.x86_64 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: https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.0.5.tar.xz Step 1 : Install build tools and other mandatory dependencies which are needed to compile and install new kernel from source. Before you ins...

Recovering or restoring grub in CentOS or RHEL 7

Image
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 ...

Recovering root user password in CentOS or RHEL 7

Image
What if you forget root user password?  RHEL/CentOS 7 has a way to recover root user password, but this will need downtime of your linux host. To recover your root user password follow below procedure as shown in screenshots: Step 1 :   Reboot host, come to GRUB screen and select Kernel without "rescue" option: PRESS "e" Step 2 :   Scroll your cursor down till you see line starting from " linux16 ".  Come  to the end of line after " UTF-8 " give a space and write " rd.break ": PRESS "CTRL + x", this will interrupt the boot process and leave you to the shell prompt : Step 3 : Once you come to shell prompt, remount "/sysroot" with "rw" permission i.e. read/write and then chroot to "/sysroot" directory: # mount -o remount,rw /sysroot/ # chroot /sysroot/ Step 4 :   Now we can go ahead and reset "root" user password using "passwd" comm...