关于内核说明:

  版本性质:主分支ml(mainline),稳定版(stable),长期维护lt(longterm)

  版本命名格式:“A.B.C"

    A代表内核版本号

    B代表内核主版本号

    C代表内核次版本号

一、检查内核版本

[root@web1 ~]# uname -r
3.10.-.el7.x86_64
[root@web1 ~]# cat /etc/redhat-release
CentOS Linux release 7.3. (Core)
[root@web1 ~]#

二、如何升级内核

    这里只关注centos7如何升级

  1、导入elrepo的key然后在安装elrepo的yum源:

rpm -import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org ###key
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm ###yum源

 

  2、查看可用的内核相关的包

yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
 [root@web1 ~]# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
Loaded plugins: fastestmirror, langpacks
elrepo-kernel | 2.9 kB ::
elrepo-kernel/primary_db | 1.8 MB ::
Loading mirror speeds from cached hostfile
* elrepo-kernel: mirrors.tuna.tsinghua.edu.cn
Available Packages
kernel-lt.x86_64 4.4.-.el7.elrepo elrepo-kernel
kernel-lt-devel.x86_64 4.4.-.el7.elrepo elrepo-kernel
kernel-lt-doc.noarch 4.4.-.el7.elrepo elrepo-kernel
kernel-lt-headers.x86_64 4.4.-.el7.elrepo elrepo-kernel
kernel-lt-tools.x86_64 4.4.-.el7.elrepo elrepo-kernel
kernel-lt-tools-libs.x86_64 4.4.-.el7.elrepo elrepo-kernel
kernel-lt-tools-libs-devel.x86_64 4.4.-.el7.elrepo elrepo-kernel
15 kernel-ml.x86_64 5.1.5-1.el7.elrepo elrepo-kernel
kernel-ml-devel.x86_64 5.1.-.el7.elrepo elrepo-kernel
kernel-ml-doc.noarch 5.1.-.el7.elrepo elrepo-kernel
kernel-ml-headers.x86_64 5.1.-.el7.elrepo elrepo-kernel
kernel-ml-tools.x86_64 5.1.-.el7.elrepo elrepo-kernel
kernel-ml-tools-libs.x86_64 5.1.-.el7.elrepo elrepo-kernel
kernel-ml-tools-libs-devel.x86_64 5.1.-.el7.elrepo elrepo-kernel
perf.x86_64 5.1.-.el7.elrepo elrepo-kernel
python-perf.x86_64 5.1.-.el7.elrepo

    

  3、安装内核(我这里用最新的吧)以后如何继续升级直接用下面这条命令就可以了

yum -y --enablerepo=elrepo-kernel install kernel-ml.x86_64 kernel-ml-devel.x86_64 

三、修改grub中默认的内核版本

  内核升级完成后,还需要调整

  1、查看内核启动顺序

 awk -F\' '$=="menuentry " {print $}' /etc/grub2.cfg

  通过此命令可以看到新内核顺序为0

 [root@web1 ~]# awk -F\' '$=="menuentry " {print $}' /etc/grub2.cfg
CentOS Linux (5.1.-.el7.elrepo.x86_64) (Core)
CentOS Linux (3.10.-.el7.x86_64) (Core)
CentOS Linux (-rescue-b7671beb75f14e95b5a58975dae3a897) (Core)
You have new mail in /var/spool/mail/root
[root@web1 ~]# vim /etc/default/g
google-chrome grub

  2、修改内核启动顺序为0

     vim /etc/default/grub

 [root@web1 ~]# vim /etc/default/grub 

 GRUB_TIMEOUT=
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
5 GRUB_DEFAULT=0
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet net.ifnames=0 biosdevname=0 "
GRUB_DISABLE_RECOVERY="true"

  

  3、接着用命令来创建内核配置

    grub2-mkconfig -o /boot/grub2/grub.cfg

 [root@web1 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.1.-.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-5.1.-.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.-.el7.x86_64
Found initrd image: /boot/initramfs-3.10.-.el7.x86_64.img
Found linux image: /boot/vmlinuz--rescue-b7671beb75f14e95b5a58975dae3a897
Found initrd image: /boot/initramfs--rescue-b7671beb75f14e95b5a58975dae3a897.img
done

   

  4、重启查看变化

      init 6或者reboot

[root@web1 ~]# init 
[root@web1 ~]# uname -r
5.1.5-1.el7.elrepo.x86_64
[root@web1 ~]# cat /etc/redhat-release
CentOS Linux release 7.3. (Core)
[root@web1 ~]#

参考:升级Centos 7/6内核版本到4.12.4的方法,还介绍了无法上网机器的升级方法

转载请注明出处:https://www.cnblogs.com/zhangxingeng/p/10941781.html

如何升级centos7 内核方法的更多相关文章

  1. Centos7升级新内核

    由于觉得Centos7内核版本还不够高,就想升级下,下面是升级步骤 我使用的方法是使用yum升级内核 使用第三方仓库升级 CentOS 允许使用 ELRepo,这是一个第三方仓库,可以将内核升级到最新 ...

  2. centos7内核升级及curl访问https证书过期处理

    centos7内核升级及curl访问https证书过期处理 先看下当前系统的linux内核版本 uname -r 3.10.0-229.el7.x86_64 升级步骤 1.rpm --import h ...

  3. Centos6.x升级内核方法支持Docker

    Centos6升级内核方法_百度经验https://jingyan.baidu.com/article/7e4409531bda252fc1e2ef4c.html

  4. centos7升级最新内核

    由于最近在测试ceph 的straw2算法,但是要使用straw2需要最新为4.1.0的内核,因此决定将虚机内核升级最新4.11.4. 步骤1.检查本机内核版本 #uname -sr 3.10.0-5 ...

  5. centos 升级linux内核

    =============================================== 2018/1/14_第1次修改                       ccb_warlock == ...

  6. CentOS 7.4升级Linux内核

    CentOS 7.4升级Linux内核 [日期:2018-01-15] 来源:Linux社区  作者:straycats [字体:大 中 小] 由于最近intel出了Meltdown和Spectre两 ...

  7. Linux TCP漏洞 CVE-2019-11477 CentOS7 修复方法

    CVE-2019-11477漏洞简单介绍 https://cert.360.cn/warning/detail?id=27d0c6b825c75d8486c446556b9c9b68 RedHat用户 ...

  8. 升级linux内核(2.6.32->3.10.81),安装docker

    1.内核升级环境准备 #查看已经安装的和未安装的软件包组,来判断我们是否安装了相应的开发环境和开发库: yum grouplist #一般是安装这两个软件包组,这样做会确定你拥有编译时所需的一切工具 ...

  9. centos6.5升级Linux内核步骤

    centos6.5升级Linux内核步骤 http://www.jianshu.com/p/c75f00182b4c 使用的操作系统是是centos6.5,按照官方的推荐的配置,把linux内核升级到 ...

随机推荐

  1. java/spring boot/dubbo/spring cloud/微服务/SOA/分布式经典电子书籍pdf下载

    微服务系列 官方文档是最好的资料了. spring cloud官方文档:https://cloud.spring.io/spring-cloud-static/Greenwich.RELEASE/si ...

  2. win10: windows+E 改回打开我的电脑

    之前习惯使用windows+E来打开我的电脑,用了win10之后按windows+E打开的却是“快速访问”文件夹,很不习惯,可用下列办法改回: 1.打开“查看”选项卡,选择”选项“按钮. 2.在“常规 ...

  3. C++提示没有与这些操作数匹配的<<运算符

    应该是忘了#include.#include<string>

  4. PHP 对象接口

    对象接口 (interface) 使用接口(interface),可以指定某个类必须实现哪些方法,但不需要定义这些方法的具体内容. 接口是通过 interface 关键字来定义的,就像定义一个标准的类 ...

  5. typescript命名空间

    /* 命名空间: 在代码量较大的情况下,为了避免各种变量命名相冲突,可将相似功能的函数.类.接口等放置到命名空间内 同Java的包..Net的命名空间一样,TypeScript的命名空间可以将代码包裹 ...

  6. 一、postman简介

    一.场景 1.开发接口的时候需要快速的调用接口,以便调试 2.测试的时候需要非常方便的调用接口,通过不同的参数去测试接口的输出 3.这些接口调用是需要保存下来的反复运行的 4.在运行过程中如果有断言( ...

  7. test20190904

  8. osg gdal加载tif数据文件

    osg加载.tif地形数据文件 #ifdef _WIN32 #include <Windows.h> #endif // _WIN32 #include <iostream> ...

  9. Linux下压力测试命令ab

    ab命令被集成到了httpd服务器中,所以想要使用ab命令需要先安装httpd服务.yum -y install httpd (1).ab命令的使用方法和常用选项 ab [选项] [http[s]:/ ...

  10. 【物联网】arduino wifi

    https://www.arduino.cn/forum.php?mod=viewthread&tid=49561 http://dy.163.com/v2/article/detail/DC ...