您的位置:首页 > 运维架构 > Linux

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

2017-07-02 07:44 489 查看

https://linoxide.com/linux-how-to/upgrade-linux-kernel-stable-3-18-4-centos/

注意操作后修改grub引导顺序,否则默认还是用老的kernel引导
vim /boot/grub/grub.conf 设置 default = 0 或者直接输入  grub2-set-default 0  然后重启。


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

Posted on : January 30, 2015 , Last Updated on : January 30, 2015 By Arun
Pyasi
   

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





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

#  cd /tmp/

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


 


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.

cp /boot/config-2.6.32-358.11.1.el6.x86_64 .config

sh -c ' yes “” | 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





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 :-)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: