许吉友 - 运维

CentOS 内核升级

$ rpm -import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
$ sudo rpm -Uvh https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
$ yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
$ sudo yum --enablerepo=elrepo-kernel install kernel-ml.x86_64 kernel-ml-devel.x86_64
$ sudo awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
$ sudo vim /etc/default/grub # saved 改为 0
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
$ sudo reboot

切换内核版本:

$ # 查看顺序
$ sudo awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
$ # 查看当前启动项
$ sudo grub2-editenv list
$ # 设置启动项
$ sudo grub2-set-default 1
$ # 在此查看确认当前启动项
$ sudo grub2-editenv list
$ # 生成新配置
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
$ # 重启
$ sudo reboot