1. 下载 RPM 包
wget http://mirrors.coreix.net/elrepo-archive-archive/kernel/el7/x86_64/RPMS/kernel-lt-5.4.278-1.el7.elrepo.x86_64.rpm
wget http://mirrors.coreix.net/elrepo-archive-archive/kernel/el7/x86_64/RPMS/kernel-lt-devel-5.4.278-1.el7.elrepo.x86_64.rpm
wget http://mirrors.coreix.net/elrepo-archive-archive/kernel/el7/x86_64/RPMS/kernel-lt-doc-5.4.278-1.el7.elrepo.noarch.rpm
wget http://mirrors.coreix.net/elrepo-archive-archive/kernel/el7/x86_64/RPMS/kernel-lt-headers-5.4.278-1.el7.elrepo.x86_64.rpm
wget http://mirrors.coreix.net/elrepo-archive-archive/kernel/el7/x86_64/RPMS/kernel-lt-tools-5.4.278-1.el7.elrepo.x86_64.rpm
wget http://mirrors.coreix.net/elrepo-archive-archive/kernel/el7/x86_64/RPMS/kernel-lt-tools-libs-5.4.278-1.el7.elrepo.x86_64.rpm
wget http://mirrors.coreix.net/elrepo-archive-archive/kernel/el7/x86_64/RPMS/kernel-lt-tools-libs-devel-5.4.278-1.el7.elrepo.x86_64.rpm
2. 安装 RPM 包
使用 yum
安装(会自动处理依赖)
yum localinstall -y kernel-lt-5.4.278-1.el7.elrepo.x86_64.rpm
yum localinstall -y kernel-lt-devel-5.4.278-1.el7.elrepo.x86_64.rpm
yum localinstall -y kernel-lt-doc-5.4.278-1.el7.elrepo.noarch.rpm
yum localinstall -y kernel-lt-headers-5.4.278-1.el7.elrepo.x86_64.rpm
yum localinstall -y kernel-lt-tools-5.4.278-1.el7.elrepo.x86_64.rpm
yum localinstall -y kernel-lt-tools-libs-5.4.278-1.el7.elrepo.x86_64.rpm
yum localinstall -y kernel-lt-tools-libs-devel-5.4.278-1.el7.elrepo.x86_64.rpm
3.查看系统上的所有可用内核:
awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
4.设置新的内核为grub2的默认版本
通过 grub2-set-default 0 命令设置
其中 0 是上面查询出来的可用内核
grub2-set-default 0
5.生成 grub 配置文件并重启
grub2-mkconfig -o /boot/grub2/grub.cfg
6.重启系统生效:reboot