Linux系统内核升级
脚本基于Centos 7
1、查看系统内核版本
1$ uname -r
23.10.0-514.26.2.el7.x86_64
3$ cat /etc/redhat-release
4CentOS Linux release 7.6.1810 (Core)
2、升级内核
导入elrepo的key,然后安装elrepo的yum源
1$ rpm -import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
2$ rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
查看可用的内核相关包
1$ yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
主分支ml(mainline),稳定版(stable),长期维护版lt(longterm) 安装内核
1$ yum -y --enablerepo=elrepo-kernel install kernel-ml.x86_64 kernel-ml-devel.x86_64
3、修改grub
1# 查看系统内核列表
2$ awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
3CentOS Linux (5.2.11-1.el7.elrepo.x86_64) 7 (Core) # 新内核(5.2.11)在0的位置上
4CentOS Linux (3.10.0-957.27.2.el7.x86_64) 7 (Core)
5CentOS Linux (3.10.0-514.26.2.el7.x86_64) 7 (Core)
6CentOS Linux (3.10.0-514.el7.x86_64) 7 (Core)
7CentOS Linux (0-rescue-963c2c41b08343f7b063dddac6b2e486) 7 (Core)
8
9$ vim /etc/default/grub
10#将 GRUB_DEFAULT=saved 改为 GRUB_DEFAULT=0
11
12# 重建内核配置
13$ grub2-mkconfig -o /boot/grub2/grub.cfg
14
15# or 使用第二种命令行方式,减少操作复杂度,减少出错机率
16
17# 查看系统内核列表
18$ cat /boot/grub2/grub.cfg | grep menuentry
19if [ x"${feature_menuentry_id}" = xy ]; then
20 menuentry_id_option="--id"
21 menuentry_id_option=""
22export menuentry_id_option
23menuentry 'CentOS Linux (6.2.2-1.el7.elrepo.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-1160.81.1.el7.x86_64-advanced-fbc2582d-2e8a-4c41-8ba8-83656d8df89b' {
24menuentry 'CentOS Linux (3.10.0-1160.83.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-1160.81.1.el7.x86_64-advanced-fbc2582d-2e8a-4c41-8ba8-83656d8df89b' {
25menuentry 'CentOS Linux (3.10.0-1160.81.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-1160.81.1.el7.x86_64-advanced-fbc2582d-2e8a-4c41-8ba8-83656d8df89b' {
26menuentry 'CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-1160.el7.x86_64-advanced-fbc2582d-2e8a-4c41-8ba8-83656d8df89b' {
27menuentry 'CentOS Linux (0-rescue-9745ea2ecc634c89aef55f4dc21ee8fc) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-9745ea2ecc634c89aef55f4dc21ee8fc-advanced-fbc2582d-2e8a-4c41-8ba8-83656d8df89b' {
28# 配置默认内核
29$ grub2-set-default "CentOS Linux (6.2.2-1.el7.elrepo.x86_64) 7 (Core)"
30# 验证修改结果
31$ grub2-editenv list
32saved_entry=CentOS Linux (6.2.2-1.el7.elrepo.x86_64) 7 (Core)
4、重启系统
1$ reboot
2
3#查看内核版本
4$ uname -r
55.2.11-1.el7.elrepo.x86_64
相关专栏文章
- Nuitka 参数列表
- ProxmoxVE 配置 DHCP 网络
- Windows防火墙配置
- 在 CentOS 上部署 NetBIOS
- Tmux 命令
- 配置 CentOS 7 的 CT 容器
- Ncftp 使用手册
- Centos7 安装 Postgresql
- 在CentOS中安装 Laravel 框架
- 虚拟主机安装 Laravel 框架
- snap 设置代理
- Rime输入法设置
- Windows系统配置
- 灌篮高手大结局(全国大赛后) 下
- 灌篮高手大结局(全国大赛后) 上
- VScode 在 Docker 容器内开发
- VSCode 配置 Python 开发环境
- ProxmoxVE 配置 BBR
- ProxmoxVE 关闭订阅提示
- Linux 文本文件操作
- Deepin 使用远程桌面
- Hyper-V 下设置 Deepin 分辨率
- VsCode 使用 Remote SSH 连接 Alpine Linux
- Alpine Linux 安装 Bash
- frp安装配置
- Alpine Linux 配置
- screen 命令
- Systemd 系统工具命令指南
- ProxmoxVE 命令行
- Hyper-V 环境下给 CentOS 磁盘扩容
- Hyper-V 下设置 Ubuntu 分辨率
- Windows 10 家庭版安装 Hyper-V
- Hyper-V 网络设置
- Docker Compose 指令
- 使用 SSH 连接 Github
- Alpine Linux 安装 Docker
- Alpine Linux 网络设置
- 虚拟机安装 Alpine Linux 3.16
- 山克 UPS 安装手册
- Git 命令行
- 使用 Snap 安装 Docker
- (CentOS 7 | Rocky 9) 安装 Docker
- 修复 ProxmoxVE RRD 错误
- FFmpeg脚本
- Yum 版本库管理
- Linux系统内核升级
- iptables 配置
- ProxmoxVE 配置 NAT 网络
- MySQL 数据操作
- 使用 nmcli 配置网络
- 使用 sed 命令操作
- Linux 系统初始化配置
- Github使用Hugo生成Blog
- Docker使用命令
- About
- Search