Linux Tutorials

How to upgrade or update kernel of the CentOS 7/ RHEL 7 to Latest stable Kernel


The kernel is the core of the operating system, and runs the CPU, manages system memory, controls access to disk drives, and contains device drivers that enable you to interact with the system and use the hardware and peripherals attached to the  computer.Naturally, kernel update  appeals most system administrators who are responsible for wringing the most performance and benefit out of their existing hardware and software. In some cases, rebuilding the kernel(kernel upgrade or kernel update) is required in order to support new hardware that is not supported, or that is poorly supported, by your system’s existing kernel.

Why Should you upgrade/update

  1. Security Fixes
  2. Stability Improvements
  3. Updated Drivers
  4. New Kernel Functions
  5. Increased Speed

for kernel compile you need more memory and processor for faster compilation other wise it will take more time for compile.

i have following configuration

guess_linux_kernel_upgrade1 guess_linux_kernel_upgrade2

Check the current kernel of the system by using uname –r option.

uname –r


Download latest stable kernel from the latest stable kernel is 4.7.6


curl -O

guess_linux_kernel_upgrade5 guess_linux_kernel_upgrade6

Then extract the kernel source by using tar –jxvf and copy to /usr/src as follows

tar -Jxvf linux-4.7.6.tar.xz
cp -rf linux-4.7.6 /usr/src

cd /usr/src/

guess_linux_kernel_upgrade7 guess_linux_kernel_upgrade8 guess_linux_kernel_upgrade9 guess_linux_kernel_upgrade10

cd linux-4.7.6


run the following command for GCC and other development tools

yum group install "Development Tools"


then install bc to run kernel compile

yum install bc


Then run the command make mrproper

make mrproper


then run following command

yum install ncurses-devel ncurses


Then run the command make menuconfig

make menuconfig

guess_linux_kernel_upgrade12 guess_linux_kernel_upgrade16 guess_linux_kernel_upgrade17 guess_linux_kernel_upgrade18 guess_linux_kernel_upgrade19

just set as default if you want to modify you can modify and then save and exit

Now install the package openssl-devel package by using yum

yum install openssl-devel


Then run the command make it takes a moment please be patient and wait.


i have 8 cpu so i run

make -j8


Then run the command make modules

make modules -j8

guess_linux_kernel_upgrade20 guess_linux_kernel_upgrade21 guess_linux_kernel_upgrade25 guess_linux_kernel_upgrade26 guess_linux_kernel_upgrade28 guess_linux_kernel_upgrade29

now install modules by using the command make modules_install.

make modules_install -j8

guess_linux_kernel_upgrade30 guess_linux_kernel_upgrade32

Now run the command make install

make install -j8


Following command can be used to list the kernels in centos 7

egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'


reboot the system by using following command


You can use grub2-set-default command to set default boot kernel, to set first kernel in grub2.cfg as default run and reboot.

here i have in second that why i run following command

grub2-set-default 1


then remove unused kernel

yum list kernel.*

yum remove kernel-version number

i have run the following command as per my version

yum remove kernel-3.10.0-327.36.1.el7

guess_linux_kernel_upgrade42 guess_linux_kernel_upgrade43 guess_linux_kernel_upgrade44


run the following command

name -r



Remove Build Folder


Thank You

1 Comment

  • I enjoy what you guys are usually up too. This type of clever work and coverage!
    Keeep up the superb works guys I’ve incorporated you guys to my
    own blogroll.

Leave a Comment