Centos(kernel)内核升级
约 757 字大约 3 分钟
Centos(kernel)内核升级
内核版本列表
状态 | 版本 | 日期 | tarball | pgp | patch | inc.patch | view diff | browse | changelog |
---|---|---|---|---|---|---|---|---|---|
mainline: | 6.8-rc7 | 2024-03-03 | tarball | patch | inc. patch | view diff | browse | ||
stable: | 6.7.9 | 2024-03-06 | tarball | pgp | patch | inc. patch | view diff | browse | changelog |
longterm: | 6.6.21 | 2024-03-06 | tarball | pgp | patch | inc. patch | view diff | browse | changelog |
longterm: | 6.1.81 | 2024-03-06 | tarball | pgp | patch | inc. patch | view diff | browse | changelog |
longterm: | 5.15.151 | 2024-03-06 | tarball | pgp | patch | inc. patch | view diff | browse | changelog |
longterm: | 5.10.212 | 2024-03-06 | tarball | pgp | patch | inc. patch | view diff | browse | changelog |
longterm: | 5.4.271 | 2024-03-06 | tarball | pgp | patch | inc. patch | view diff | browse | changelog |
longterm: | 4.19.309 | 2024-03-06 | tarball | pgp | patch | inc. patch | view diff | browse | changelog |
linux-next: | next-20240307 | 2024-03-07 | browse |
- longterm:长期支持版本
- stable:稳定版本
- mainline:主线版本
导入该源的秘钥
# 1、导入该源的秘钥
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
# 2、启用该源仓库
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-6.el7.elrepo.noarch.rpm
或者:
yum -y install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
查看可升级的内核版本
yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
可安装的软件包
kernel-lt(基于长期支持分支) 5.4.271-1.el7.elrepo
kernel-ml(主流的,来源于主线稳定分支提供) 5.4.271-1.el7.elrepo
安装内核
yum --enablerepo=elrepo-kernel install -y kernel-lt-5.4.211-1.el7.elrepo
查看当前系统内可用内核
awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
设置开机从新内核版本启动
其中 0 是上面查询出来的可用内核编号
grub2-set-default 0 && reboot
删除当前无用的系统内核版本
查看所有已安装的内核版本
[root@init ~]# rpm -qa | grep kernel
kernel-tools-libs-3.10.0-1160.76.1.el7.x86_64
kernel-3.10.0-1160.76.1.el7.x86_64
kernel-headers-3.10.0-1160.76.1.el7.x86_64
kernel-devel-3.10.0-1160.el7.x86_64
kernel-tools-3.10.0-1160.76.1.el7.x86_64
kernel-devel-3.10.0-1160.76.1.el7.x86_64
kernel-lt-5.4.271-1.el7.elrepo.x86_64
kernel-3.10.0-1160.el7.x86_64
abrt-addon-kerneloops-2.1.11-60.el7.centos.x86_64
当前使用的内核版本
[root@init ~]# uname -r
5.4.271-1.el7.elrepo.x86_64
删除
yum remove -y kernel-3.10.0-1160.el7.x86_64 kernel-3.10.0-1160.76.1.el7.x86_64
或
yum remove $(rpm -qa | grep kernel | grep -v $(uname -r))
# 全部卸载后重新安装
[root@init ~]# yum --enablerepo=elrepo-kernel install -y kernel-lt-5.4.271-1.el7.elrepo \
kernel-lt-doc-5.4.271-1.el7.elrepo \
kernel-lt-headers-5.4.271-1.el7.elrepo \
kernel-lt-tools-5.4.271-1.el7.elrepo \
kernel-lt-tools-libs-5.4.271-1.el7.elrepo \
kernel-lt-tools-libs-devel-5.4.271-1.el7.elrepo \
kernel-lt-devel-5.4.271-1.el7.elrepo
[root@init ~]# rpm -qa | grep kernel
kernel-lt-5.4.271-1.el7.elrepo.x86_64
kernel-lt-doc-5.4.271-1.el7.elrepo.noarch
kernel-lt-tools-5.4.271-1.el7.elrepo.x86_64
kernel-lt-tools-libs-5.4.271-1.el7.elrepo.x86_64
kernel-lt-tools-libs-devel-5.4.271-1.el7.elrepo.x86_64
kernel-lt-headers-5.4.271-1.el7.elrepo.x86_64
abrt-addon-kerneloops-2.1.11-60.el7.centos.x86_64
kernel-lt-devel-5.4.271-1.el7.elrepo.x86_64
安装其他工具
yum install -y gcc make ncurses-devel openssl-devel flex bison elfutils-libelf-devel