[root@docker ~]# uname -r #查看内核版本,centos7.x默认是3.10.0 Linux docker 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
内核下载地址:
https://elrepo.org/linux/kernel/el7/x86_64/RPMS/
[root@docker ~]# ls #上传升级包 kernel-ml-5.19.12-1.el7.elrepo.x86_64.rpm kernel-ml-devel-5.19.12-1.el7.elrepo.x86_64.rpm [root@docker ~]# yum -y install kernel-ml-5.19.12-1.el7.elrepo.x86_64.rpm #安装 已加载插件:fastestmirror Repository epel is listed more than once in the configuration Repository epel-source is listed more than once in the configuration 正在检查 kernel-ml-5.19.12-1.el7.elrepo.x86_64.rpm: kernel-ml-5.19.12-1.el7.elrepo.x86_64 kernel-ml-5.19.12-1.el7.elrepo.x86_64.rpm 将被安装 正在解决依赖关系 --> 正在检查事务 ---> 软件包 kernel-ml.x86_64.0.5.19.12-1.el7.elrepo 将被 安装 --> 解决依赖关系完成 依赖关系解决 =========================================================================================== Package 架构 版本 源 大小 =========================================================================================== 正在安装: kernel-ml x86_64 5.19.12-1.el7.elrepo /kernel-ml-5.19.12-1.el7.elrepo.x86_64 277 M 事务概要 =========================================================================================== 安装 1 软件包 总计:277 M 安装大小:277 M Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction 警告:RPM 数据库已被非 yum 程序修改。 ** 发现 6 个已存在的 RPM 数据库问题, 'yum check' 输出如下: glibc-2.17-326.el7_9.x86_64 是 glibc-2.17-317.el7.x86_64 的副本 glibc-common-2.17-326.el7_9.x86_64 是 glibc-common-2.17-317.el7.x86_64 的副本 krb5-libs-1.15.1-54.el7_9.x86_64 是 krb5-libs-1.15.1-50.el7.x86_64 的副本 1:openssl-1.0.2k-25.el7_9.x86_64 是 1:openssl-1.0.2k-19.el7.x86_64 的副本 1:openssl-libs-1.0.2k-25.el7_9.x86_64 是 1:openssl-libs-1.0.2k-19.el7.x86_64 的副本 zlib-1.2.7-20.el7_9.x86_64 是 zlib-1.2.7-18.el7.x86_64 的副本 正在安装 : kernel-ml-5.19.12-1.el7.elrepo.x86_64 1/1 验证中 : kernel-ml-5.19.12-1.el7.elrepo.x86_64 1/1 已安装: kernel-ml.x86_64 0:5.19.12-1.el7.elrepo 完毕! [root@docker ~]# yum -y install kernel-ml-devel-5.19.12-1.el7.elrepo.x86_64.rpm #安装 已加载插件:fastestmirror Repository epel is listed more than once in the configuration Repository epel-source is listed more than once in the configuration 正在检查 kernel-ml-devel-5.19.12-1.el7.elrepo.x86_64.rpm: kernel-ml-devel-5.19.12-1.el7.elrepo.x86_64 kernel-ml-devel-5.19.12-1.el7.elrepo.x86_64.rpm 将被安装 正在解决依赖关系 --> 正在检查事务 ---> 软件包 kernel-ml-devel.x86_64.0.5.19.12-1.el7.elrepo 将被 安装 --> 解决依赖关系完成 依赖关系解决 =========================================================================================== Package 架构 版本 源 大小 =========================================================================================== 正在安装: kernel-ml-devel x86_64 5.19.12-1.el7.elrepo /kernel-ml-devel-5.19.12-1.el7.elrepo.x86_64 57 M 事务概要 =========================================================================================== 安装 1 软件包 总计:57 M 安装大小:57 M Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安装 : kernel-ml-devel-5.19.12-1.el7.elrepo.x86_64 1/1 验证中 : kernel-ml-devel-5.19.12-1.el7.elrepo.x86_64 1/1 已安装: kernel-ml-devel.x86_64 0:5.19.12-1.el7.elrepo 完毕! [root@docker ~]# awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg #查看系统上的所有可用内核 0 : CentOS Linux (5.19.12-1.el7.elrepo.x86_64) 7 (Core) 1 : CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core) 2 : CentOS Linux (0-rescue-f38aeb19d04f4ce698153ee23a0a21e5) 7 (Core) [root@docker ~]# cp /etc/default/grub /etc/default/grub-bak #备份配置文件 [root@docker ~]# grub2-set-default 0 #设置默认内核版本 [root@docker ~]# vi /etc/default/grub #修改配置文件 GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=saved #修改成GRUB_DEFAULT=0 GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet" GRUB_DISABLE_RECOVERY="true" [root@docker ~]# grub2-mkconfig -o /boot/grub2/grub.cfg #重新创建内核配置 Generating grub configuration file ... Found linux image: /boot/vmlinuz-5.19.12-1.el7.elrepo.x86_64 Found initrd image: /boot/initramfs-5.19.12-1.el7.elrepo.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-1160.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-1160.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-f38aeb19d04f4ce698153ee23a0a21e5 Found initrd image: /boot/initramfs-0-rescue-f38aeb19d04f4ce698153ee23a0a21e5.img done [root@docker ~]# grubby --default-kernel #查看默认内核 /boot/vmlinuz-5.19.12-1.el7.elrepo.x86_64 [root@docker ~]# grub2-editenv list #查看配置 saved_entry=0 [root@docker ~]# reboot #重启操作系统,生效 [root@docker ~]# uname -r #再次查看内核版本 5.19.12-1.el7.elrepo.x86_64
标签:12,x86,elrepo,centos7,64,5.19,el7 From: https://www.cnblogs.com/xgsh/p/16775874.html