linux内核3.14.4,升级CentOS7内核版本至4.14(长期支持版本)

原文链接: https://www.tecmint.com/install-upgrade-kernel-version-in-centos-7/

Although some people use the word Linux to represent the operating system as a whole, it is important to note that, strictly speaking, Linux is only the kernel. On the other hand, a distribution is a fully-functional system built on top of the kernel with a wide variety of application tools and libraries.

During normal operations, the kernel is responsible for performing two important tasks:Acting as an interface between the hardware and the software running on the system.

Managing system resources as efficiently as possible.

To do this, the kernel communicates with the hardware through the drivers that are built into it or those that can be later installed as a module.

For example, when an application running on your machine wants to connect to a wireless network, it submits that request to the kernel, which in turns uses the right driver to connect to the network.

With new devices and technology coming out periodically, it is important to keep our kernel up to date if we want to make the most of out them. Additionally, updating our kernel will help us to leverage new kernel functions and to protect ourselves from vulnerabilities that have been discovered in previous versions.

Ready to update your kernel on CentOS 7 or one of their derivatives such asRHEL 7 and Fedora? If so, keep reading!

Step 1: Checking Installed Kernel Version

When we install a distribution it includes a certain version of the Linux kernel. To show the current version installed on our system we can do:# uname -sr

The following image shows the output of the above command in a CentOS 7 server:

468ba4a84f79ae2a63df24bddf2b5cdc.png

Check Kernel Version in CentOS 7

If we now go to https://www.kernel.org/, we will see that the latest kernel version is 4.14 at the time of this writing (other versions are available from the same site).

This new Kernel 4.14 version is a long-term release and will be supported for 6 years, earlier all Linux Kernel versions were supported for 2 years only.

One important thing to consider is the life cycle of a kernel version – if the version you are currently using is approaching its end of life, no more bug fixes will be provided after that date. For more info, refer to the kernel Releases page.

Step 2: Upgrading Kernel in CentOS 7

Most modern distributions provide a way to upgrade the kernel using a package management system such as yum and an officially-supported repository.

However, this will only perform the upgrade to the most recent version available from the distribution’s repositories – not the latest one available in the https://www.kernel.org/. Unfortunately, Red Hat only allows to upgrade the kernel using the former option.

As opposed to Red Hat, CentOS allows the use of ELRepo, a third-party repository that makes the upgrade to a recent version a kernel.

To enable the ELRepo repository on CentOS 7, do:# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm

2ab354d5c4d9d45942509bcc0cac30b6.png

Enable ELRepo in CentOS 7

Once the repository has been enabled, you can use the following command to list the available kernel.related packages:# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available

5a744115bac7a19bb6c843c7113362f3.png

Yum – Find Available Kernel Versions

Next, install the latest mainline stable kernel:# yum --enablerepo=elrepo-kernel install kernel-ml

09ddcf9151e4e4cabf8fa85dbea17e71.png

Install Latest Kernel Version in CentOS 7

Finally, reboot your machine to apply the latest kernel, and then run following command to check the kernel version:uname -sr

05ab235c186f15815f808ca7a548dbca.png

Verify Kernel Version

Step 3: Set Default Kernel Version in GRUB

To make the newly-installed version the default boot option, you will have to modify the GRUB configuration as follows:

Open and edit the file /etc/default/grub and set GRUB_DEFAULT=0. This means that the first kernel in the GRUB initial screen will be used as default.GRUB_TIMEOUT=5GRUB_DEFAULT=0GRUB_DISABLE_SUBMENU=true

GRUB_TERMINAL_OUTPUT="console"

GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet"

GRUB_DISABLE_RECOVERY="true"

Next, run the following command to recreate the kernel configuration.# grub2-mkconfig -o /boot/grub2/grub.cfg

988ddba1fc1098dc70b56aadfac6e44c.png

Set Kernel in GRUB

Reboot and verify that the latest kernel is now being used by default.

e38f61728415a42def20950c31ec413c.png

Booting Default Kernel Version in CentOS 7

Congratulations! You have upgraded your kernel in CentOS 7!

Summary

In this article we have explained how to easily upgrade the Linux kernel on your system. There is yet another method which we haven’t covered as it involves compiling the kernel from source, which would deserve an entire book and is not recommended on production systems.

Although it represents one of the best learning experiences and allows for a fine-grained configuration of the kernel, you may render your system unusable and may have to reinstall it from scratch.

If you are still interested in building the kernel as a learning experience, you will find instructions on how to do it at the Kernel Newbies page.

As always, feel free to use the form below if you have any questions or comments about this article.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值