1. 查看操作系统内核版本
$ uname -r
3.10.0-1062.4.1.el7.x86_64
2. 安装ELRepo
官网地址:http://elrepo.org/tiki/tiki-index.php
$ rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
$ yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
3. 查看内核版本列表
$ yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
Loading mirror speeds from cached hostfile
* elrepo-kernel: mirrors.tuna.tsinghua.edu.cn
elrepo-kernel | 3.0 kB 00:00:00
elrepo-kernel/primary_db | 2.0 MB 00:00:04
可安装的软件包
kernel-lt.x86_64 5.4.162-1.el7.elrepo elrepo-kernel
kernel-lt-devel.x86_64 5.4.162-1.el7.elrepo elrepo-kernel
kernel-lt-doc.noarch 5.4.162-1.el7.elrepo elrepo-kernel
kernel-lt-headers.x86_64 5.4.162-1.el7.elrepo elrepo-kernel
kernel-lt-tools.x86_64 5.4.162-1.el7.elrepo elrepo-kernel
kernel-lt-tools-libs.x86_64 5.4.162-1.el7.elrepo elrepo-kernel
kernel-lt-tools-libs-devel.x86_64 5.4.162-1.el7.elrepo elrepo-kernel
kernel-ml.x86_64 5.15.5-1.el7.elrepo elrepo-kernel
kernel-ml-devel.x86_64 5.15.5-1.el7.elrepo elrepo-kernel
kernel-ml-doc.noarch 5.15.5-1.el7.elrepo elrepo-kernel
kernel-ml-headers.x86_64 5.15.5-1.el7.elrepo elrepo-kernel
kernel-ml-tools.x86_64 5.15.5-1.el7.elrepo elrepo-kernel
kernel-ml-tools-libs.x86_64 5.15.5-1.el7.elrepo elrepo-kernel
kernel-ml-tools-libs-devel.x86_64 5.15.5-1.el7.elrepo elrepo-kernel
perf.x86_64 5.15.5-1.el7.elrepo elrepo-kernel
python-perf.x86_64 5.15.5-1.el7.elrepo elrepo-kernel
4. 安装最新的稳定版本内核
$ yum -y --enablerepo=elrepo-kernel install kernel-lt
5. 查看系统上面可以使用的内核
$ awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux (5.15.5-1.el7.elrepo.x86_64) 7 (Core)
1 : CentOS Linux (3.10.0-1160.45.1.el7.x86_64) 7 (Core)
2 : CentOS Linux (3.10.0-957.1.3.el7.x86_64) 7 (Core)
3 : CentOS Linux (3.10.0-693.el7.x86_64) 7 (Core)
4 : CentOS Linux (0-rescue-8c140402428842fe94fb7aa44b8df5d0) 7 (Core)
6. 修改启动顺序默认值
方法1:命令操作
$ grub2-set-default 0
7. 生产grub 配置文件
$ grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.15.5-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-5.15.5-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1160.45.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.45.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.1.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.1.3.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-693.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-8c140402428842fe94fb7aa44b8df5d0
Found initrd image: /boot/initramfs-0-rescue-8c140402428842fe94fb7aa44b8df5d0.img
done
8. 重新启动
$ reboot
$ uname -r
5.15.5-1.el7.elrepo.x86_64
标签:kernel,x86,elrepo,升级,cenos7,64,内核,5.15,el7
From: https://blog.51cto.com/u_16281224/7609172