centos7 升级最新版内核

查看内核

uname -r

设置内核源

主要是 http://elrepo.org/tiki/tiki-index.php

ELRepo 仓库是基于社区的用于企业级 Linux 仓库,提供对 RedHat Enterprise (RHEL) 和 其他基于 RHEL的 Linux 发行版(CentOS、Scientific、Fedora 等)的支持。
ELRepo 聚焦于和硬件相关的软件包,包括文件系统驱动、显卡驱动、网络驱动、声卡驱动和摄像头驱动等。

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh https://www.elrepo.org/elrepo-release-7.0-4.el7.elrepo.noarch.rpm

查看可用系统内核包

yum --disablerepo="*" --enablerepo="elrepo-kernel" list available

4.4 和5.2 可以使用

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * elrepo-kernel: hkg.mirror.rackspace.com
elrepo-kernel                                                                                                                                                        | 2.9 kB  00:00:00
elrepo-kernel/primary_db                                                                                                                                             | 1.8 MB  00:00:00
Available Packages
kernel-lt.x86_64                                                                                                          4.4.190-1.el7.elrepo                                                                                          elrepo-kernel
kernel-lt-devel.x86_64                                                                                                    4.4.190-1.el7.elrepo                                                                                          elrepo-kernel
kernel-lt-doc.noarch                                                                                                      4.4.190-1.el7.elrepo                                                                                          elrepo-kernel
kernel-lt-headers.x86_64                                                                                                  4.4.190-1.el7.elrepo                                                                                          elrepo-kernel
kernel-lt-tools.x86_64                                                                                                    4.4.190-1.el7.elrepo                                                                                          elrepo-kernel
kernel-lt-tools-libs.x86_64                                                                                               4.4.190-1.el7.elrepo                                                                                          elrepo-kernel
kernel-lt-tools-libs-devel.x86_64                                                                                         4.4.190-1.el7.elrepo                                                                                          elrepo-kernel
kernel-ml-devel.x86_64                                                                                                    5.2.11-1.el7.elrepo                                                                                           elrepo-kernel
kernel-ml-doc.noarch                                                                                                      5.2.11-1.el7.elrepo                                                                                           elrepo-kernel
kernel-ml-headers.x86_64                                                                                                  5.2.11-1.el7.elrepo                                                                                           elrepo-kernel
kernel-ml-tools.x86_64                                                                                                    5.2.11-1.el7.elrepo                                                                                           elrepo-kernel
kernel-ml-tools-libs.x86_64                                                                                               5.2.11-1.el7.elrepo                                                                                           elrepo-kernel
kernel-ml-tools-libs-devel.x86_64                                                                                         5.2.11-1.el7.elrepo                                                                                           elrepo-kernel
perf.x86_64                                                                                                               5.2.11-1.el7.elrepo                                                                                           elrepo-kernel
python-perf.x86_64                                                                                                        5.2.11-1.el7.elrepo 

安装最新内核

yum --enablerepo=elrepo-kernel install kernel-ml

设置内核

更新内核

grub2-mkconfig -o /boot/grub2/grub.cfg

输出

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.2.11-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-5.2.11-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.27.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.27.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-3ec831eb45704879a36ae8fd8a558327
Found initrd image: /boot/initramfs-0-rescue-3ec831eb45704879a36ae8fd8a558327.img
done

查看系统内核

cat /boot/grub2/grub.cfg |grep menuentry
if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
  menuentry_id_option=""
export menuentry_id_option
menuentry 'CentOS Linux (5.2.11-1.el7.elrepo.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-5.2.11-1.el7.elrepo.x86_64-advanced-682078f3-2c57-4d07-9bc0-50758075a37a' {
menuentry 'CentOS Linux (3.10.0-957.27.2.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.27.2.el7.x86_64-advanced-682078f3-2c57-4d07-9bc0-50758075a37a' {
menuentry 'CentOS Linux (3.10.0-957.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.el7.x86_64-advanced-682078f3-2c57-4d07-9bc0-50758075a37a' {
menuentry 'CentOS Linux (0-rescue-3ec831eb45704879a36ae8fd8a558327) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-3ec831eb45704879a36ae8fd8a558327-advanced-682078f3-2c57-4d07-9bc0-50758075a37a' {

设置内核

先复制要设置的内核CentOS Linux (5.2.11-1.el7.elrepo.x86_64) 7 (Core)
设置默认内核

grub2-set-default "CentOS Linux (5.2.11-1.el7.elrepo.x86_64) 7 (Core)"

验证

grub2-editenv list 

重启电脑

reboot

验证内核

uname -r

输出

5.2.11-1.el7.elrepo.x86_64

参考
http://elrepo.org/tiki/tiki-index.php
https://blog.csdn.net/kikajack/article/details/79396793
https://blog.csdn.net/cacacai/article/details/79727218

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

风.foxwho

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
>