参考文档
https://blog.csdn.net/carefree2005/article/details/114819885
1、内核升级步骤
1)、查看可升级版本
使用命令yum list kernel可以查看已安装的内核版本和可以升级至的最新内核版本,示例最新可以升级的内核版本为3.10.0-1160.15.2
[root@test1 yum.repos.d]# yum list kernel
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.ustc.edu.cn
* extras: mirrors.ustc.edu.cn
* updates: mirrors.ustc.edu.cn
Installed Packages
kernel.x86_64 3.10.0-957.el7 @anaconda
Available Packages
kernel.x86_64 3.10.0-1160.15.2.el7 updates
2)、升级内核版本至最新版本
[root@test1 yum.repos.d]# yum update -y kernel
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.ustc.edu.cn
* extras: mirrors.ustc.edu.cn
* updates: mirrors.ustc.edu.cn
Resolving Dependencies
–> Running transaction check
—> Package kernel.x86_64 0:3.10.0-1160.15.2.el7 will be installed
–> Processing Dependency: linux-firmware >= 20190429-72 for package: kernel-3.10.0-1160.15.2.el7.x86_64
–> Running transaction check
—> Package linux-firmware.noarch 0:20180911-69.git85c5d90.el7 will be updated
—> Package linux-firmware.noarch 0:20200421-80.git78c0348.el7_9 will be an update
–> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================
Installing:
kernel x86_64 3.10.0-1160.15.2.el7 updates 50 M
Updating for dependencies:
linux-firmware noarch 20200421-80.git78c0348.el7_9 updates 80 M
Transaction Summary
=====================================================================================================================================================
Install 1 Package
Upgrade ( 1 Dependent package)
Total download size: 131 M
Downloading packages:
No Presto metadata available for updates
(1/2): linux-firmware-20200421-80.git78c0348.el7_9.noarch.rpm | 80 MB 00:00:11
(2/2): kernel-3.10.0-1160.15.2.el7.x86_64.rpm | 50 MB 00:00:12
-----------------------------------------------------------------------------------------------------------------------------------------------------
Total 10 MB/s | 131 MB 00:00:12
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : linux-firmware-20200421-80.git78c0348.el7_9.noarch 1/3
Installing : kernel-3.10.0-1160.15.2.el7.x86_64 2/3
Cleanup : linux-firmware-20180911-69.git85c5d90.el7.noarch 3/3
Verifying : linux-firmware-20200421-80.git78c0348.el7_9.noarch 1/3
Verifying : kernel-3.10.0-1160.15.2.el7.x86_64 2/3
Verifying : linux-firmware-20180911-69.git85c5d90.el7.noarch 3/3
Installed:
kernel.x86_64 0:3.10.0-1160.15.2.el7
Dependency Updated:
linux-firmware.noarch 0:20200421-80.git78c0348.el7_9
Complete!
3)、查看已安装的所有内核版本
[root@test1 yum.repos.d]# rpm -q kernel
kernel-3.10.0-957.el7.x86_64
kernel-3.10.0-1160.15.2.el7.x86_64
4)、重启操作系统
[root@test1 yum.repos.d]# reboot
5)、查看当前操作系统内核版本
[root@test1 ~]# uname -a
Linux test1 3.10.0-1160.15.2.el7.x86_64 #1 SMP Wed Feb 3 15:06:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
6)、卸载旧内核
此步骤可选,建议卸载旧内核之前,先验证系统安装的软件是否正常运行
[root@test1 ~]# yum remove kernel-3.10.0-957.el7.x86_64 -y
7)、清理包
[root@test1 ~]# yum clean all