Upgrade to Kernel 4.x on CentOS 6/CentOS 7/ RHEL 7

Upgrade Linux Kernel to 4.x

Kernel 4.x is highly optimised and gives a lot of boost in performance to all Linux servers, here are few simple commands to upgrade your Kernel to 4.x on your CentOS 6 / CentOS 7 / RHEL 7 VPS (It will work with any KVM Based VPS like the ones provided by hosteons.com) or Dedicated server :

CentOS 6 / RHEL 6:

rpm –import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

rpm -Uvh http://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm

yum install yum-plugin-fastestmirror

yum –enablerepo=elrepo-kernel install kernel-ml

Now update /etc/grub.conf and make sure the new kernel 4.x is selected as default kernel and just reboot your VPS/Dedicated Server to use the new kernel.

CentOS 7/RHEL 7:

rpm –import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm

yum install yum-plugin-fastestmirror

yum –enablerepo=elrepo-kernel install kernel-ml

Now update /etc/grub.conf and make sure the new kernel 4.x is selected as default kernel and just reboot your VPS/Dedicated Server to use the new kernel.

Reset root password when stuck at FSCK

Stuck at FSCK but your root password is not working ?

Here is a short tutorial on how to reset root password on a  Linux VPS or Dedicated Server 

  1. First login to your VPS control panel and use VNC to access the VPS Console and if it’s a Dedicated server either use the IPMI or use a KVM to go to console of your server.
  2. Now let your system boot and press spare on grub menu to pause the system from booting and going at fsck prompt
  3. Now select the last working kernel and press ‘e’
  4. Now Go to the link similar to below and press ‘e’:    “kernel /vmlinuz-x.x.x.x root=UUID.x.x.x.x ro rhgb quiet”
  5. Delete ‘ro’ from the line and append ‘init= /bin/bash’ for CentOS or ‘init= /bin/sh’ for Debian
  6. Press ‘Enter’ or ‘Return” key to save and the press ‘b’ to boot into single user mode
  7. Now the system should directly take you to your single user mode shell. Now type below command to mount the / file system in read write: mount -o remount rw /
  8. Once / File system is mounted, you can then change the root password with “passwd” command
  9. Now you can again reboot your system and run fsck using the above root password