Saturday, 25 March 2017

How to Upgrade Linux Kernel to Stable 3.18.4 on CentOS 7.x

Linux Kernel 3.18.4 Stable

There was a recent announcement of the release of Latest kernel 3.18.4 which includes many changes, you can check the Changelog for the complete list of changes.
WARNING: Installing a new kernel may render your system unusable or unstable. If you proceed with the installation using the instructions below, make sure you back up any important data you have to an external hard drive.

Installing Linux Kernel 3.18.4

So, we're gonna install our latest and stable release of linux kernel 3.18.4 on our CentOS 7 Linux Distribution which is based on fedora. We we'll be tutoring about 2 common ways of install linux kernel 3.18.4 on CentOS 7.
1. Using ELRepo
2. Compiling and installing from the source
Note: Please make sure to choose anyone of the above ways.
First we'll gonna go for installing using ELRepo as its the easiest way to do.

Installing using Elrepo

1. Downloading and Installing ELRepo

We'll first gonna download the GPG key of ELRepo and install the relrepo-release package. As this tutorial is for CentOS 7. We'll gonna install elrepo-release-7.0-2.el7.elrepo.noarch.rpm using the command below.
Note: If you have a secure boot enabled please see this page for more information.
# rpm --import
# rpm -Uvh

2. Updating Kernel to version 3.18.4

Now, we'll gonna install the latest stable kernel 3.18.4 from the ELRepo repository. To do so, we'll need to enter the following commands in a shell or terminal of the CentOS 7.
# yum --enablerepo=elrepo-kernel install kernel-ml

The above command will automatically install the Linux Kernel 3.18.4 build for CentOS 7.
Now, here below is the another way of installing the latest kernel 3.18.4 by compiling from the source.

Compiling and Installing from the Source

1. Installing the Dependencies

So, first of all we'll need to install the dependencies required to compile the linux kernel but most of the machines must have it preinstalled.

# yum install gcc ncurses ncurses-devel
Then, we'll gonna update our whole system.
# yum update

2. Downloading the package

We'll now gonna download the latest and stable release of linux kernel 3.18.4 inside /tmp using wget command from the official repository of Linux Kernel. You can also download the kernel directly from the site .
#  cd /tmp/
# wget


3. Extracting the package

Once the file is downloaded we'll extract it under /usr/src/ directory by running the below command.
# tar -xf linux-3.18.4.tar.xz -C /usr/src/
# cd /usr/src/linux-3.18.4/

4. Configuring

For New Kernel Configuration

Now we'll run the make menuconfig command in the shell or terminal to configure the Linux kernel. Once we've executed the below command a pop up window with all the menus appears. Here we can select our new kernel configuration. If you unfamiliar with these menus, just hit double ESC key to exit.
# make menuconfig

For Old Configuration

If you like to configure your latest kernel with old configuration then simple type the below command.
# make oldconfig

Step 5: Compiling

Next, we'll execute the make command to compile the Kernel 3.18.4 . The compilation would take at least 20-30 minutes depends on your system configuration. I had got an error while compiling the kernel saying bc command not found. You can fix that by installing bc using the command yum install bc .
# make

6. Installing into the system

Once the compliation is complished. We'll now finally install the Kernel in our Linux System. The below command will create files under /boot directory and also make a new kernel entry in your grub.conf file.
# make modules_install install

7. Verifying Kernel

After installing our latest kernel 3.18.4 we'll want to verify it. To do so we'll just type the following command on the terminal. If everything went fine, we'll get your kernel version ie. 3.18.4 enlisted in the output.

# uname -r


No comments:

Post a Comment