centos7内核升级

默认centos7的内核版本是3.10,升级的缘由是为了测试openvswitch的vlan技术,默认openvswitch的2.3版本是容许centos7默认内核3.10支持,下面是软件与内核版本对比html

    Open vSwitch   Linux kernel
    ------------   -------------
        1.4.x      2.6.18 to 3.2
        1.5.x      2.6.18 to 3.2
        1.6.x      2.6.18 to 3.2
        1.7.x      2.6.18 to 3.3
        1.8.x      2.6.18 to 3.4
        1.9.x      2.6.18 to 3.8
        1.10.x     2.6.18 to 3.8
        1.11.x     2.6.18 to 3.8
        2.0.x      2.6.32 to 3.10
        2.1.x      2.6.32 to 3.11
        2.2.x      2.6.32 to 3.14

但如何想使用gre与vxlan的话,须要内核3.12以上的centos

    Protocol    Linux Kernel
    --------    ------------
      GRE           3.11
      VXLAN         3.12
      LISP      <not upstream>

 

因此得升级内核,下面是升级方法bash

更新前,内核版本为ide

 

[root@ip-10-10-17-4 tmp] # uname -r
3.10.0-123.el7.x86_64

 

下面是升级的方法:测试

一、导入keyui

 
rpm -- import  https: //www .elrepo.org /RPM-GPG-KEY-elrepo .org

若是你修改了repo的gpgcheck=0也能够不导入keycentos7

二、安装elrepo的yum源spa

 

 
rpm -Uvh http: //www .elrepo.org /elrepo-release-7 .0-2.el7.elrepo.noarch.rpm

三、安装内核code

在yum的ELRepo源中,有mainline(3.18.3)这个内核版本htm

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

选择了使用新安装的repo来安装3.18的内核,若是使用其余的repo,看不到3.18版本内核

更新后查看内核版本

[root@ip-10-10-17-4 tmp] # uname -r
3.10.0-123.el7.x86_64

重要:目前内核仍是默认的版本,若是在这一步完成后你就直接reboot了,重启后使用的内核版本仍是默认的3.10,不会使用新的3.18,想修改启动的顺序,须要进行下一步

查看默认启动顺序

awk  -F\ ' ' $1== "menuentry "  {print $2}'  /etc/grub2 .cfg
CentOS Linux (3.18.3-1.el7.elrepo.x86_64) 7 (Core)
CentOS Linux, with Linux 3.10.0-123.el7.x86_64
CentOS Linux, with Linux 0-rescue-893b160e363b4ec7834719a7f06e67cf

默认启动的顺序是从0开始,但咱们新内核是从头插入(目前位置在0,而3.10的是在1),因此须要选择0,若是想生效最新的内核,须要

 

 
grub2- set -default 0

以上问题能够参考https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sec-Customizing_GRUB_2_Menu.html#sec-Changing_the_Default_Boot_Entry

而后reboot重启,使用新的内核,下面是重启后使用的内核版本

[root@ip-10-10-17-4 ~] # uname -r
3.18.3-1.el7.elrepo.x86_64

完成后内核已是最新的了。

相关文章
相关标签/搜索