暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Centos 7.9升级内核到ml最新版本验证测试

原创 尚雷 2022-11-23
462

注意:如生产环境升级,千万千万要谨慎,务必在测试环境做详尽测试。

Centos 7.9 当前默认内核为 3.10.0-1160.66.1.el7.x86_64,为更好兼容Ceph新版,和采用ansible部署Ceph,此处尝试升级Centos 7.9内核到最新版本。

首先要求服务器配置YUM源,能连接外网。

一、导入public key

[root@mon01 ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

二、安装epel源

[root@mon01 ~]# yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm

三、查看可用内核版本

[root@mon01 ~]# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
Loaded plugins: fastestmirror                                                                                         
Repository base is listed more than once in the configuration                                                         
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Determining fastest mirrors
 * elrepo-kernel: mirrors.tuna.tsinghua.edu.cn
elrepo-kernel                                                                                                             | 3.0 kB  00:00:00    
elrepo-kernel/primary_db                                                                                                  | 2.1 MB  00:00:01    
Available Packages
kernel-lt.x86_64                                                                  5.4.209-1.el7.elrepo                    elrepo-kernel
kernel-lt-devel.x86_64                                                            5.4.209-1.el7.elrepo                    elrepo-kernel
kernel-lt-doc.noarch                                                              5.4.209-1.el7.elrepo                    elrepo-kernel
kernel-lt-headers.x86_64                                                          5.4.209-1.el7.elrepo                    elrepo-kernel
kernel-lt-tools.x86_64                                                            5.4.209-1.el7.elrepo                    elrepo-kernel
kernel-lt-tools-libs.x86_64                                                       5.4.209-1.el7.elrepo                    elrepo-kernel
kernel-lt-tools-libs-devel.x86_64                                                 5.4.209-1.el7.elrepo                    elrepo-kernel
kernel-ml.x86_64                                                                  5.19.0-1.el7.elrepo                     elrepo-kernel
kernel-ml-devel.x86_64                                                            5.19.0-1.el7.elrepo                     elrepo-kernel
kernel-ml-doc.noarch                                                              5.19.0-1.el7.elrepo                     elrepo-kernel
kernel-ml-headers.x86_64                                                          5.19.0-1.el7.elrepo                     elrepo-kernel
kernel-ml-tools.x86_64                                                            5.19.0-1.el7.elrepo                     elrepo-kernel
kernel-ml-tools-libs.x86_64                                                       5.19.0-1.el7.elrepo                     elrepo-kernel
kernel-ml-tools-libs-devel.x86_64                                                 5.19.0-1.el7.elrepo                     elrepo-kernel
perf.x86_64                                                                       5.19.0-1.el7.elrepo                     elrepo-kernel
python-perf.x86_64                                                                5.19.0-1.el7.elrepo                     elrepo-kernel

四、选择安装ml最新版本

[root@mon01 ~]# yum --enablerepo=elrepo-kernel install kernel-ml

五、查看系统上可用内核

[root@mon01 ~]# awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux (5.19.0-1.el7.elrepo.x86_64) 7 (Core)
1 : CentOS Linux (3.10.0-1160.66.1.el7.x86_64) 7 (Core)
2 : CentOS Linux (3.10.0-957.27.2.el7.x86_64) 7 (Core)
3 : CentOS Linux (3.10.0-693.el7.x86_64) 7 (Core)
4 : CentOS Linux (0-rescue-cd654f5766bc4dc5a33d92cd884a0baf) 7 (Core)
 
# 注意前面 数字编号

六、设置启动内核

[root@mon01 ~]# grub2-set-default 0

七、重启服务器验证内核

[root@mon01 ~]# reboot
[root@mon01 ~]# rpm -qa | grep kernel
kernel-tools-libs-3.10.0-1160.66.1.el7.x86_64
kernel-tools-3.10.0-1160.66.1.el7.x86_64
kernel-3.10.0-957.27.2.el7.x86_64
kernel-3.10.0-1160.66.1.el7.x86_64
kernel-3.10.0-693.el7.x86_64
kernel-headers-3.10.0-1160.66.1.el7.x86_64
kernel-ml-5.19.0-1.el7.elrepo.x86_64

八、删除旧版内核

yum remove -y kernel-tools-libs-3.10.0-1160.66.1.el7.x86_64
yum remove -y kernel-tools-3.10.0-1160.66.1.el7.x86_64
yum remove -y kernel-3.10.0-957.27.2.el7.x86_64
yum remove -y kernel-3.10.0-1160.66.1.el7.x86_64
yum remove -y kernel-3.10.0-693.el7.x86_64
yum remove -y kernel-headers-3.10.0-1160.66.1.el7.x86_64

== 注意:==
如希望升级后,还能回退到之前系统内核,可采用如下方法:
awk -F’ ‘$1=="menuentry " {print i++ " : " $2}’ /etc/grub2.cfg
grub2-set-default 0
grub2-mkconfig -o /boot/grub2/grub.cfg
uname -r
reboot

最后修改时间:2022-11-29 09:29:58
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论