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

博观而约取 厚积而薄发

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

CentOS内核升级

WinJay
2021-11-04 / 0 评论 / 0 点赞 / 16 阅读 / 6,023 字 / 正在检测是否收录...
温馨提示:
本文最后更新于 2021-12-15,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。
[root@Master1 ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
[root@Master1 ~]# yum install -y https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
已加载插件:fastestmirror
elrepo-release-7.el7.elrepo.noarch.rpm                                                                   | 8.6 kB  00:00:00
正在检查 /var/tmp/yum-root-R2Kbc8/elrepo-release-7.el7.elrepo.noarch.rpm: elrepo-release-7.0-5.el7.elrepo.noarch
/var/tmp/yum-root-R2Kbc8/elrepo-release-7.el7.elrepo.noarch.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 elrepo-release.noarch.0.7.0-5.el7.elrepo 将被 安装
--> 解决依赖关系完成

依赖关系解决

================================================================================================================================
 Package                   架构              版本                          源                                              大小
================================================================================================================================
正在安装:
 elrepo-release            noarch            7.0-5.el7.elrepo              /elrepo-release-7.el7.elrepo.noarch            5.0 k

事务概要
================================================================================================================================
安装  1 软件包

总计:5.0 k
安装大小:5.0 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : elrepo-release-7.0-5.el7.elrepo.noarch                                                                      1/1
  验证中      : elrepo-release-7.0-5.el7.elrepo.noarch                                                                      1/1

已安装:
  elrepo-release.noarch 0:7.0-5.el7.elrepo

完毕!
[root@Master1 ~]# yum list available --disablerepo=* --enablerepo=elrepo-kernel
已加载插件: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
可安装的软件包
kernel-lt.x86_64                                                5.4.142-1.el7.elrepo                               elrepo-kernel
kernel-lt-devel.x86_64                                          5.4.142-1.el7.elrepo                               elrepo-kernel
kernel-lt-doc.noarch                                            5.4.142-1.el7.elrepo                               elrepo-kernel
kernel-lt-headers.x86_64                                        5.4.142-1.el7.elrepo                               elrepo-kernel
kernel-lt-tools.x86_64                                          5.4.142-1.el7.elrepo                               elrepo-kernel
kernel-lt-tools-libs.x86_64                                     5.4.142-1.el7.elrepo                               elrepo-kernel
kernel-lt-tools-libs-devel.x86_64                               5.4.142-1.el7.elrepo                               elrepo-kernel
kernel-ml.x86_64                                                5.13.12-1.el7.elrepo                               elrepo-kernel
kernel-ml-devel.x86_64                                          5.13.12-1.el7.elrepo                               elrepo-kernel
kernel-ml-doc.noarch                                            5.13.12-1.el7.elrepo                               elrepo-kernel
kernel-ml-headers.x86_64                                        5.13.12-1.el7.elrepo                               elrepo-kernel
kernel-ml-tools.x86_64                                          5.13.12-1.el7.elrepo                               elrepo-kernel
kernel-ml-tools-libs.x86_64                                     5.13.12-1.el7.elrepo                               elrepo-kernel
kernel-ml-tools-libs-devel.x86_64                               5.13.12-1.el7.elrepo                               elrepo-kernel
perf.x86_64                                                     5.13.12-1.el7.elrepo                               elrepo-kernel
python-perf.x86_64                                              5.13.12-1.el7.elrepo                               elrepo-kernel
[root@Master1 ~]# cat /boot/grub2/grub.cfg | grep menuentry
if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
  menuentry_id_option=""
export menuentry_id_option
menuentry 'CentOS Linux (3.10.0-1160.36.2.el7.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-2cb24f10-dfb6-4251-8936-377c66e627c0' {
menuentry 'CentOS Linux (3.10.0-1160.el7.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-2cb24f10-dfb6-4251-8936-377c66e627c0' {
menuentry 'CentOS Linux (0-rescue-e759430c2ff54581b2b72d53bbf4ae74) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-e759430c2ff54581b2b72d53bbf4ae74-advanced-2cb24f10-dfb6-4251-8936-377c66e627c0' {
[root@Master1 ~]#
[root@Master1 ~]# yum install -y kernel-lt.x86_64  --enablerepo=elrepo-kernel
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.bupt.edu.cn
 * elrepo: mirrors.tuna.tsinghua.edu.cn
 * elrepo-kernel: mirrors.tuna.tsinghua.edu.cn
 * epel: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.bupt.edu.cn
elrepo                                                                                                   | 3.0 kB  00:00:00
elrepo/primary_db                                                                                        | 395 kB  00:00:00
正在解决依赖关系
--> 正在检查事务
---> 软件包 kernel-lt.x86_64.0.5.4.142-1.el7.elrepo 将被 安装
--> 解决依赖关系完成

依赖关系解决

================================================================================================================================
 Package                    架构                    版本                                   源                              大小
================================================================================================================================
正在安装:
 kernel-lt                  x86_64                  5.4.142-1.el7.elrepo                   elrepo-kernel                   50 M

事务概要
================================================================================================================================
安装  1 软件包

总下载量:50 M
安装大小:227 M
Downloading packages:
kernel-lt-5.4.142-1.el7.elrepo.x86_64.rpm                                                                |  50 MB  00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : kernel-lt-5.4.142-1.el7.elrepo.x86_64                                                                       1/1
  验证中      : kernel-lt-5.4.142-1.el7.elrepo.x86_64                                                                       1/1

已安装:
  kernel-lt.x86_64 0:5.4.142-1.el7.elrepo

完毕!
[root@Master1 ~]#cat /boot/grub2/grub.cfg | grep menuentry		## 查看系统可用内核
if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
  menuentry_id_option=""
export menuentry_id_option
menuentry 'CentOS Linux (5.4.142-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-2cb24f10-dfb6-4251-8936-377c66e627c0' {
menuentry 'CentOS Linux (3.10.0-1160.36.2.el7.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-2cb24f10-dfb6-4251-8936-377c66e627c0' {
menuentry 'CentOS Linux (3.10.0-1160.el7.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-2cb24f10-dfb6-4251-8936-377c66e627c0' {
menuentry 'CentOS Linux (0-rescue-e759430c2ff54581b2b72d53bbf4ae74) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-e759430c2ff54581b2b72d53bbf4ae74-advanced-2cb24f10-dfb6-4251-8936-377c66e627c0' {
[root@Master1 ~]# grub2-set-default "CentOS Linux (5.4.142-1.el7.elrepo.x86_64) 7 (Core)"
# 设置开机从新内核启动
[root@Master1 ~]# grub2-editenv list		#查看内核启动项
saved_entry=CentOS Linux (5.4.142-1.el7.elrepo.x86_64) 7 (Core)
[root@Master1 ~]#  uname -r			#查看当前内核版本
3.10.0-1160.36.2.el7.x86_64
[root@Master1 ~]# reboot

[root@Master1 ~]#  uname -r			#启动完成查看内核版本是否更新:



grub2-set-default "CentOS Linux (3.10.0-1160.36.2.el7.x86_64) 7 (Core)"
0

评论区