升级前内核版本:
[root@vrgv252 ~]# uname -a
Linux vrgv252.com 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
下载内核文件:
建议使用清华源
Index of /elrepo/kernel/el7/x86_64/RPMS/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
下面是官方的下载比较慢
https://mirrors.tuna.tsinghua.edu.cn/elrepo/kernel/el7/x86_64/RPMS/
进入后可以看到很多版本文件,一般选择次lt版本文件即可
说明:lt长期维护版 ml最新稳定版
我在这里使用两个包即可升级成功
kernel-lt-5.4.209-1.el7.elrepo.x86_64.rpm
kernel-lt-devel-5.4.209-1.el7.elrepo.x86_64.rpm
1.把两个文件放到/rpm目录下
- .
使用rpm命令安装
[root@vrgv252 rpm]# rpm -ivh *
- 1.
注:这个/rpm目录下只有两个rpm包,所以才可以这么写。如果有报错,如perl错误等问题,先升级perl依赖包。
2.看下现在的内核排序
[root@vrgv252 ~]# awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
- 1.
修改内核启动参数为:0,将GRUB_DEFAULT=saved修改为0,此处为0,则改为GRUB_DEFAULT=0
[root@vrgv252 ~]# vim /etc/default/grub
3.使用grub2-mkconfig命令来重新创建内核配置
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.91-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-5.4.91-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-86044f9e52ab45b886b99d6bd1729b08
Found initrd image: /boot/initramfs-0-rescue-86044f9e52ab45b886b99d6bd1729b08.img
done
4.重启启动服务器
[root@vrgv252 rpm]# init 6
- 1.
5.验证
本文含有隐藏内容,请 开通VIP 后查看