侧边栏壁纸
博主头像
WinJay博主等级

博观而约取 厚积而薄发

  • 累计撰写 319 篇文章
  • 累计创建 169 个标签
  • 累计收到 1 条评论
隐藏侧边栏

CentOS升级内核

WinJay
2021-12-02 / 0 评论 / 0 点赞 / 82 阅读 / 2,387 字 / 正在检测是否收录...
温馨提示:
本文最后更新于 2021-12-15,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

载入公钥

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

安装 ELRepo 最新版本

yum install -y https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm

列出可以使用的 kernel 包版本

yum list available --disablerepo=* --enablerepo=elrepo-kernel

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
elrepo-kernel: mirrors.tuna.tsinghua.edu.cn
elrepo-kernel                                                                                                                  | 3.0 kB  00:00:00     
elrepo-kernel/primary_db                                                                                                       | 2.0 MB  00:00:00     
Available Packages
kernel-lt.x86_64                                                           5.4.162-1.el7.elrepo                                          elrepo-kernel
kernel-lt-devel.x86_64                                                     5.4.162-1.el7.elrepo                                          elrepo-kernel
kernel-lt-doc.noarch                                                       5.4.162-1.el7.elrepo                                          elrepo-kernel
kernel-lt-headers.x86_64                                                   5.4.162-1.el7.elrepo                                          elrepo-kernel
kernel-lt-tools.x86_64                                                     5.4.162-1.el7.elrepo                                          elrepo-kernel
kernel-lt-tools-libs.x86_64                                                5.4.162-1.el7.elrepo                                          elrepo-kernel
kernel-lt-tools-libs-devel.x86_64                                          5.4.162-1.el7.elrepo                                          elrepo-kernel
kernel-ml.x86_64                                                           5.15.5-1.el7.elrepo                                           elrepo-kernel
kernel-ml-devel.x86_64                                                     5.15.5-1.el7.elrepo                                           elrepo-kernel
kernel-ml-doc.noarch                                                       5.15.5-1.el7.elrepo                                           elrepo-kernel
kernel-ml-headers.x86_64                                                   5.15.5-1.el7.elrepo                                           elrepo-kernel
kernel-ml-tools.x86_64                                                     5.15.5-1.el7.elrepo                                           elrepo-kernel
kernel-ml-tools-libs.x86_64                                                5.15.5-1.el7.elrepo                                           elrepo-kernel
kernel-ml-tools-libs-devel.x86_64                                          5.15.5-1.el7.elrepo                                           elrepo-kernel
perf.x86_64                                                                5.15.5-1.el7.elrepo                                           elrepo-kernel
python-perf.x86_64                                                         5.15.5-1.el7.elrepo                                           elrepo-kernel

安装指定的 kernel 版本:

yum install -y kernel-lt.x86_64 --enablerepo=elrepo-kernel

查看系统可用内核

cat /boot/grub2/grub.cfg | grep menuentry
	menuentry 'CentOS Linux (3.10.0-1062.el7.x86_64) 7 (Core)' --class centos (略)
	menuentry 'CentOS Linux (4.4.218-1.el7.elrepo.x86_64) 7 (Core)' --class centos ...(略)


menuentry 'CentOS Linux (5.4.162-1.el7.elrepo.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-1160.el7.x86_64-advanced-3153fb87-fd2a-4cca-b938-8a2a97f7ffcd' {
menuentry 'CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentr_id_option 'gnulinux-3.10.0-1160.el7.x86_64-advanced-3153fb87-fd2a-4cca-b938-8a2a97f7ffcd' {
menuentry 'CentOS Linux (0-rescue-8703a975bb214778a37caadda8ee332d) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-8703a975bb214778a37caadda8ee332d-advanced-3153fb87-fd2a-4cca-b938-8a2a97f7ffcd' {

设置开机从新内核启动

grub2-set-default 'CentOS Linux (5.4.162-1.el7.elrepo.x86_64) 7 (Core)'

查看内核启动项

grub2-editenv list
saved_entry=CentOS Linux (5.4.162-1.el7.elrepo.x86_64) 7 (Core)
0

评论区