1. 查看当前centos及内核版本:
[root@localhost ~]# uname -sr
Linux 3.10.0-327.el7.x86_64
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
2. 启用ELRepo第三方仓库,可以将内核升级到最新版本:
[root@localhost ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
[root@localhost ~]# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
Retrieving http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
Retrieving http://elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
Preparing... ################################# [100%]
Updating / installing...
1:elrepo-release-7.0-3.el7.elrepo ################################# [100%]
[root@localhost ~]#
3. 仓库启用后,可以查看可用的内核包:
[root@localhost ~]# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
Loaded plugins: auto-update-debuginfo, fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* elrepo-kernel: mirrors.neusoft.edu.cn
Available Packages
kernel-lt.x86_64 4.4.150-1.el7.elrepo elrepo-kernel
kernel-lt-devel.x86_64 4.4.150-1.el7.elrepo elrepo-kernel
kernel-lt-doc.noarch 4.4.150-1.el7.elrepo elrepo-kernel
kernel-lt-headers.x86_64 4.4.150-1.el7.elrepo elrepo-kernel
kernel-lt-tools.x86_64 4.4.150-1.el7.elrepo elrepo-kernel
kernel-lt-tools-libs.x86_64 4.4.150-1.el7.elrepo elrepo-kernel
kernel-lt-tools-libs-devel.x86_64 4.4.150-1.el7.elrepo elrepo-kernel
kernel-ml-devel.x86_64 4.18.3-1.el7.elrepo elrepo-kernel
kernel-ml-doc.noarch 4.18.3-1.el7.elrepo elrepo-kernel
kernel-ml-headers.x86_64 4.18.3-1.el7.elrepo elrepo-kernel
kernel-ml-tools.x86_64 4.18.3-1.el7.elrepo elrepo-kernel
kernel-ml-tools-libs.x86_64 4.18.3-1.el7.elrepo elrepo-kernel
kernel-ml-tools-libs-devel.x86_64 4.18.3-1.el7.elrepo elrepo-kernel
perf.x86_64 4.18.3-1.el7.elrepo elrepo-kernel
python-perf.x86_64 4.18.3-1.el7.elrepo elrepo-kernel
4. 更新最新内核:(2018-08-21当前仓库中最新为:kernel-ml-4.18.3-1.el7.elrepo.x86_64)
yum --enablerepo=elrepo-kernel install kernel-ml
Loaded plugins: auto-update-debuginfo, fastestmirror, langpacks
elrepo | 2.9 kB 00:00:00
elrepo-kernel | 2.9 kB 00:00:00
(1/2): elrepo/primary_db | 469 kB 00:00:16
(2/2): elrepo-kernel/primary_db | 1.8 MB 00:00:47
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* elrepo: mirrors.neusoft.edu.cn
* elrepo-kernel: mirrors.neusoft.edu.cn
* extras: mirror.bit.edu.cn
* updates: mirrors.163.com
Resolving Dependencies
--> Running transaction check
---> Package kernel-ml.x86_64 0:4.18.3-1.el7.elrepo will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=========================================================================================================================
Package Arch Version Repository Size
=========================================================================================================================
Installing:
kernel-ml x86_64 4.18.3-1.el7.elrepo elrepo-kernel 45 M
Transaction Summary
=========================================================================================================================
Install 1 Package
Total download size: 45 M
Installed size: 203 M
Is this ok [y/d/N]: y
Downloading packages:
kernel-ml-4.18.3-1.el7.elrepo.x86_64.rpm | 45 MB 00:00:46
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : kernel-ml-4.18.3-1.el7.elrepo.x86_64 1/1
Verifying : kernel-ml-4.18.3-1.el7.elrepo.x86_64 1/1
Installed:
kernel-ml.x86_64 0:4.18.3-1.el7.elrepo
Complete!
5. 重新启动系统,选择第一行:
6. 确认查看内核版本是否更新:
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@localhost ~]# uname -sr
Linux 4.18.3-1.el7.elrepo.x86_64
[root@localhost ~]#