先查看当前内核版本
~]#uname -a
Linux localhost.localdomain 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 1659 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
查看系统grub内核启动列表
~]# awk -F' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core)
1 : CentOS Linux (0-rescue-9c44fe6cef3746b2b96d834164eb6b07) 7 (Core)
安装epel源
~]#rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
~]#yum install -y https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
查看可安装的内核版本列表
~]# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* elrepo-kernel: ftp.yz.yamagata-u.ac.jp
elrepo-kernel | 3.0 kB 0000
elrepo-kernel/primary_db | 2.1 MB 0002
可安装的软件包
kernel-lt.x86_64 5.4.270-1.el7.elrepo elrepo-kernel
kernel-lt-devel.x86_64 5.4.270-1.el7.elrepo elrepo-kernel
kernel-lt-doc.noarch 5.4.270-1.el7.elrepo elrepo-kernel
kernel-lt-headers.x86_64 5.4.270-1.el7.elrepo elrepo-kernel
kernel-lt-tools.x86_64 5.4.270-1.el7.elrepo elrepo-kernel
kernel-lt-tools-libs.x86_64 5.4.270-1.el7.elrepo elrepo-kernel
kernel-lt-tools-libs-devel.x86_64 5.4.270-1.el7.elrepo elrepo-kernel
kernel-ml.x86_64 6.7.8-1.el7.elrepo elrepo-kernel
kernel-ml-devel.x86_64 6.7.8-1.el7.elrepo elrepo-kernel
kernel-ml-doc.noarch 6.7.8-1.el7.elrepo elrepo-kernel
kernel-ml-headers.x86_64 6.7.8-1.el7.elrepo elrepo-kernel
kernel-ml-tools.x86_64 6.7.8-1.el7.elrepo elrepo-kernel
kernel-ml-tools-libs.x86_64 6.7.8-1.el7.elrepo elrepo-kernel
kernel-ml-tools-libs-devel.x86_64 6.7.8-1.el7.elrepo elrepo-kernel
perf.x86_64 5.4.270-1.el7.elrepo elrepo-kernel
python-perf.x86_64 5.4.270-1.el7.elrepo elrepo-kernel
安装最新的lt稳定版内核
~]#yum --disablerepo='*' --enablerepo=elrepo-kernel install kernel-lt -y
查看系统grub内核启动列表,5.4版本使我们最新安装的
~]# awk -F' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux (5.4.270-1.el7.elrepo.x86_64) 7 (Core)
1 : CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core)
2 : CentOS Linux (0-rescue-9c44fe6cef3746b2b96d834164eb6b07) 7 (Core)
指定以新安装的编号0的内核版本为默认启动内核
~]# grub2-set-default 0
卸载旧内核版本
~]# yum remove kernel -y
已加载插件:fastestmirror
跳过正在运行的内核:kernel-3.10.0-1160.el7.x86_64s
不删除任何软件包
重启机器,以新内核版本加载启动
~]#reboot
重启完成后再次查看内核版本,已经升级为最新的5.4版本
~]# uname -a
Linux localhost.localdomain 5.4.270-1.el7.elrepo.x86_64 #1 SMP Fri Mar 1 1736 EST 2024 x86_64 x86_64 x86_64 GNU/Linux
全部0条评论
快来发表一下你的评论吧 !