默認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
|
完成後內核已是最新的了。