RPM方式升级 Kernel-lt 长期维护版(推荐) Kernel-ml Linus亲自维护的主分支版本 CentOS6 x64
内核包链接
http://mirror.rc.usf.edu/compute_lock/elrepo/kernel/el7/x86_64/RPMS/
[root@newrain ~]# uname -a
Linux newrain 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64
x86_64 x86_64 GNU/Linux
在链接中下载对应的内核包
[root@newrain ~]# wget https://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-lt-4.4.205-1.el7.elrepo.x86_64.rpm
安装
[root@newrain ~]# yum install -y kernel-lt-4.4.205-1.el7.elrepo.x86_64.rpm
查看当前内核的启动顺序
[root@newrain ~]# awk '$1=="menuentry" {print $2,$3,$4}' /etc/grub2.cfg
'CentOS Linux (3.10.0-514.el7.x86_64)
'CentOS Linux (0-rescue-8b99afb288c44ddfacf44a1c70405e6f)
修改配置文件 设置默认启动项,0是按menuentry顺序。比如要默认从第四个菜单项启动,数字改为3,若改为 saved,则默认为上次启动项。
[root@newrain ~]# sed -i "s/GRUB_DEFAULT=saved/GRUB_DEFAULT=0/g" /etc/default/grub
重写grub.cfg
[root@newrain ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
[root@newrain ~]# reboot
[root@newrain ~]# uname -a
Linux newrain 4.4.205-1.el7.elrepo.x86_64 #1 SMP Fri Nov 29 10:10:01 EST 2019 x
86_64 x86_64 x86_64 GNU/Linux
[root@newrain ~]# awk '$1=="menuentry" {print $2,$3,$4}' /etc/grub2.cfg
'CentOS Linux (4.4.205-1.el7.elrepo.x86_64)
'CentOS Linux (3.10.0-514.el7.x86_64)
'CentOS Linux (0-rescue-8b99afb288c44ddfacf44a1c70405e6f)
卸载内核
[root@newrain ~]# cd /boot/
[root@newrain ~]# rm -rf *-4* # 谨慎,一般不进行
[root@newrain ~]# vim /boot/grub2/grub.cfg
[root@newrain ~]# reboot
[root@newrain ~]# uname -r
3.10.0-514.el7.x86_64