Install Kernel 4.15 with Custom Modules on CentOS 7

Kernel 4.15 is the first stable release which is fully patched against the Meltdown and Spectre security vulnerabilities. In this guide I will show you how to install Kernel 4.15 from source and build custom modules on CentOS 7.

* CentOS 7
* Root access
* At least 15GB of disk space

Install the Required Packages

If you are using CentOS 7 minimal, you need to install few packages which are required. First, update the system software:

yum update

Then, install the required packages:

yum groupinstall "Development Tools"
yum install wget gcc ncurses-devel elfutils-libelf-devel bc openssl-devel perl

Some of these packages could be already installed on your machine.

Download Kernel 4.15

Next, download the Kernel 4.15 tarball from

cd /usr/srs

Extract the archive:

tar xvfJ linux-4.15.tar.xz

Once it is extracted, you are ready to proceed.

Select Kernel Modules

Now is time when you can select the modules you want to be compiled. Kernel modules are pieces of code that extend the functionality of the kernel. The modules can be loaded upon demand, without need to reboot the system. Navigate to the directory where you extracted the Kernel archive.

cd /usr/src/linux-4.15

Run the menuconfig:

make menuconfig

Select the modules you want compiled, then save and exit.

Install the Kernel

To compile the kernel modules and install the kernel, run the following commands one by one:

make modules_install
make install

Please note, this may take up to few hours depending on the hardware of your server.

Boot the System with the new Kernel

First, check the grub menu entries:

grep menuentry /boot/grub2/grub.cfg

Most likely, the new kernel will have index 0. In any case, make sure it is not the default one. I will set my old kernel to be the default in grub:

grub2-set-default 1

Now, reboot the system and select the new kernel from the grub menu.

Once the system is up and running run the command below to check the version of kernel:

uname -a

If you have any questions or thoughts you can post them in the comments below.

Related Posts