centos7 升级内核

Administrator
Administrator
发布于 2024-01-03 / 38 阅读
0
0

centos7 升级内核

1. 更新系统

yum update -y

2.添加elrepo软件源

yum install vim -y
vi /etc/yum.repos.d/elrepo.repo
# 添加以下内容
cat > /etc/yum.repos.d/elrepo.repo << EOF
[elrepo]
name=elrepo
baseurl=https://mirrors.aliyun.com/elrepo/archive/kernel/el7/x86_64
gpgcheck=0
enabled=1
EOF
​

3. 刷新源数据缓存

yum clean all && yum makecache

4. 安装5.4内核

4.1 列出可用内核

[root@centos7 ~]# yum list kernel-lt
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
可安装的软件包
kernel-lt.x86_64                  5.4.265-1.el7.elrepo                        elrepo

安装指定内核

yum install -y kernel-lt-5.4.265
yum install -y kernel-lt-devel-5.4.265

5. 查看安装内核版本

awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg

6. 设置默认内核

grub2-set-default 0

7. 重启

reboot


评论