开始机器的内核:
[root@localhost ~]# uname -a
Linux master1 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# uname -r
3.10.0-1160.76.1.el7.x86_64
升级内核:
[root@localhost ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
[root@localhost ~]# yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
[root@localhost ~]# yum --disablerepo=\* --enablerepo=elrepo-kernel repolist
[root@localhost ~]# yum --disablerepo=\* --enablerepo=elrepo-kernel list kernel*
[root@localhost ~]# yum -y install --disablerepo=\* --enablerepo=elrepo-kernel kernel-ml.x86_64
[root@localhost ~]# awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
[root@localhost ~]# grub2-set-default 0
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
[root@localhost ~]# reboot
验证:
[root@master2 ~]# uname -a
Linux master2 6.2.8-1.el7.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 21 18:06:47 EDT 2023 x86_64 x86_64 x86_64 GNU/Linux
[root@master2 ~]# uname -r
6.2.8-1.el7.elrepo.x86_64