下载 kernel rpm lt 包
- 下载必须文件
# tree kernel/
kernel/
├── kernel-lt-5.4.278-1.el7.elrepo.x86_64.rpm
├── kernel-lt-devel-5.4.278-1.el7.elrepo.x86_64.rpm
├── kernel-lt-doc-5.4.278-1.el7.elrepo.noarch.rpm
├── kernel-lt-headers-5.4.278-1.el7.elrepo.x86_64.rpm
├── kernel-lt-tools-5.4.278-1.el7.elrepo.x86_64.rpm
├── kernel-lt-tools-libs-5.4.278-1.el7.elrepo.x86_64.rpm
├── kernel-lt-tools-libs-devel-5.4.278-1.el7.elrepo.x86_64.rpm
├── perf-5.4.278-1.el7.elrepo.x86_64.rpm
└── python-perf-5.4.278-1.el7.elrepo.x86_64.rpm
- 查看内核列表
awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
- 安装
yum localinstall kernel-lt-5.4.278-1.el7.elrepo.x86_64.rpm
- 重建内核
grub2-mkconfig -o /boot/grub2/grub.cfg
- 配置新版内核
sed -i "s/GRUB_DEFAULT=saved/GRUB_DEFAULT=0/g" /etc/default/grub
- 重启
导入
public key
,添加扩展源
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
yum install https://www.elrepo.org/elrepo-release-7.0-4.el7.elrepo.noarch.rpm -y
安装最新稳定版
yum -y --enablerepo=elrepo-kernel install kernel-lt.x86_64 kernel-lt-devel.x86_64
删除旧版本工具包
yum remove kernel-tools-libs.x86_64 kernel-tools.x86_64 -y
安装新版本工具包
yum --disablerepo=\* --enablerepo=elrepo-kernel install -y kernel-lt-tools.x86_64
查看内核列表
awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
重建内核
grub2-mkconfig -o /boot/grub2/grub.cfg
配置新版内核
sed -i "s/GRUB_DEFAULT=saved/GRUB_DEFAULT=0/g" /etc/default/grub
重启
reboot
删除旧版本内核
oldkernel=`rpm -qa|grep kernel-[0-9]` && yum remove -y $oldkernel
导入
public key
,添加扩展源
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
yum install https://www.elrepo.org/elrepo-release-7.0-4.el7.elrepo.noarch.rpm -y
安装最新主线版
yum -y --enablerepo=elrepo-kernel install kernel-ml.x86_64 kernel-ml-devel.x86_64
删除旧版本工具包
rpm -qa|grep kernel-3|xargs -n1 rpm -e
rpm -e kernel-tools-libs-*
安装新版本工具包
yum --disablerepo=\* --enablerepo=elrepo-kernel install -y kernel-ml-tools.x86_64
查看内核列表
awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
重建内核
grub2-mkconfig -o /boot/grub2/grub.cfg
配置新版内核
grub2-set-default 0
系统盘非
raid
模式直接重启
reboot
pstore: unknown compression: deflate
启动异常
修改引导配置
vim /etc/default/grub
在GRUB_CMDLINE_LINUX
最后添加mgag200.modeset=0
配置样例
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto spectre_v2=retpoline rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet mgag200.modeset=0"
GRUB_DISABLE_RECOVERY="true"
重新生成引导文件
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg