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

January 30, 2015 | By
| 10 Replies More

Hi all, today we'll learn how to upgrade your current version of linux kernel to the latest stable version 3.18.4 on CentOS 7. Here below is a short description of what is a Linux Kernel.

Linux Kernel is the essential part of any Linux operating system. It is a Unix-like and mostly POSIX-compliant computer operating system assembled under the model of free and open-source software development and distribution. The defining component of Linux is the Linux kernel, an operating system kernel first released on 5 October 1991 by Linus Torvalds. The Free Software Foundation uses the name GNU/Linux to describe the operating system, which has led to some controversy. It is responsible for resource allocation, low-level hardware interfaces, security, simple communications, basic file system management, and more. It was writtien from scratch by Linus Torvalds (with help from various developers), Linux is a clone of the UNIX operating system. It is geared towards POSIX and Single UNIX Specification compliances.

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 https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

Installing ELRepo release

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

Installing ELRepo Linux kernel

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 kernel.org .

#  cd /tmp/
# wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.18.4.tar.xz

 Downloading Linux Kernel Package

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/

extracting compressed Kernel package

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

make menuconfig

For Old Configuration

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

# make oldconfig

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

Installing kernel

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

 Conclusion

Hurray, we have successfully installed the latest version of stable kernel ie 3.18.4 in our CentOS 7 Operating System. Upgrading a linux kernel is always not necessary cause the hardware you got working with the previous version of it may not get working with the newer version. We should make sure that the it includes the features and stuffs that are necessary to make your hardware working. But mostly, the newer stable versions of kernel makes your hardware performance better. So, if you have any questions, comments, feedback please do write on the comment box below and let us know what stuffs needs to be added or improved. Thank You! Enjoy the latest stable version of Linux Kernel 3.18.4 :-)

Filed Under : LINUX HOWTO

Free Linux Ebook to Download

Comments (10)

Trackback URL | Comments RSS Feed

  1. Robert Dinse says:

    I'm running now what is CentOS 7.1 (CentOS 7 1533) and I can install kernels from el repo fine, but when I build my own, the build process goes without error, however it breaks grub somehow and when I try to reboot instead of a grub menu I get pointer alignment errors. This doesn't happen with packaged kernels so the packaged kernels must be doing something different with grub than the makefile from kernel.org does.

  2. Noah says:

    Hi,
    Thank you for the instructions, but now it tries to install a 4.0 kernel. I would still like the 3.18 or 3.19 kernel. How can I get that?
    Thanks

    • Arun Pyasi says:

      Hi,
      You can go with the second section of this article by skipping the first section. You need to follow Compiling and Installing from the Source
      section to compile from the source.
      Thanks.

      • Noah says:

        OK, I can do that. But out of curiosity, I see in the RPMS directory under elrepo that it lists all the kernels (http://mirrors.neterra.net/elrepo/kernel/el7/x86_64/RPMS/). Is yum only able to install the latest versions?
        Thanks again

        • Arun Pyasi says:

          Those old kernels aren't available on the mirror of elrepo. The mirror that you showed above doesn't delete old files so you got the old kernel files there but you cannot use that repository directly to install your required old kernel as it doesn't contains the definition of old kernels in its repodata.
          What you can do is, download all the RPM files of the required kernel inside a new directory and run the following command inside that directory to install.

          $ sudo yum localinstall *.rpm

          Thanks :)

  3. Soufiane FADIL says:

    I installed everything wihtout any problem and when i check the version of kernel i still have the same one

    #uname -r
    #2.6.32-042stab111.12

    Any idea for that ?
    Thanks

  4. Prithvi says:

    I followed, Installing using Elrepo and installed successfully on the VM, uname -r still gives the older kernel version. How to switch to the new kernel as i am working on a VM i have no access to grub.

  5. Prithvi BV says:

    I followed, Installing using Elrepo , no errors , installed successfully, if i do uname -r , i still get the older version of kernel. I dont not have access to the grub as i am working on a VM.

    • Tauqeer says:

      @prithvi... after installing kernel use ;

      # grub2-set-default 0 (if you are using rhel7/centos7

      further reboot your system.

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.