CentOS 7.9 OS Kernel Update 3.10 to 4.19

date: 2024-01-18, 2024-01-26

原 OS Kernel 3.10
升级至 4.19

1.检查默认内核

  • 检查 vmlinuz 版本
[root@localhost ~]# grubby --default-kernel
/boot/vmlinuz-3.10.0-1160.105.1.el7.x86_64
[root@localhost ~]#
  • 检查 Linux 内核版本
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]#

2.配置 yum 源

  • 备份原 repo 源文件
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# mkdir bak;mv ./* bak
mv: cannot move ‘./bak’ to a subdirectory of itself, ‘bak/bak’
[root@localhost yum.repos.d]# ll
total 0
drwxr-xr-x 2 root root 220 Jan 25 20:24 bak
[root@localhost yum.repos.d]#
  • 下载阿里云 CentOS7 repo 源
[root@localhost yum.repos.d]# curl -o CentOS-Ali.repo https://mirrors.aliyun.com/repo/Centos-7.repo% Total    % Received % Xferd  Average Speed   Time    Time     Time  CurrentDload  Upload   Total   Spent    Left  Speed
100  2523  100  2523    0     0   2789      0 --:--:-- --:--:-- --:--:--  2787
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# ll
total 4
drwxr-xr-x 2 root root  220 Jan 25 20:24 bak
-rw-r--r-- 1 root root 2523 Jan 25 20:25 CentOS-Ali.repo
[root@localhost yum.repos.d]#
  • 更新本地 repo 源
[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum makecache fast
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
base                                                                                                                           | 3.6 kB  00:00:00
centosplus                                                                                                                     | 2.9 kB  00:00:00
extras                                                                                                                         | 2.9 kB  00:00:00
updates                                                                                                                        | 2.9 kB  00:00:00
Metadata Cache Created
[root@localhost ~]#
  • 查看 repo 源
[root@localhost ~]# yum repolist
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
repo id                                                       repo name                                                                         status
base/7/x86_64                                                 CentOS-7 - Base - mirrors.aliyun.com                                              10,072
centosplus/7/x86_64                                           CentOS-7 - Plus - mirrors.aliyun.com                                                 277
extras/7/x86_64                                               CentOS-7 - Extras - mirrors.aliyun.com                                               518
updates/7/x86_64                                              CentOS-7 - Updates - mirrors.aliyun.com                                            5,558
repolist: 16,425
[root@localhost ~]#

3.下载内核离线包

cd /opt
wget http://193.49.22.109/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-4.19.12-1.el7.elrepo.x86_64.rpm
wget http://193.49.22.109/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-devel-4.19.12-1.el7.elrepo.x86_64.rpm

4.安装内核

[root@localhost ~]# cd /opt/
[root@localhost opt]# ll
total 59068
-rw-r--r-- 1 root root 47850944 Jan 18 11:22 kernel-ml-4.19.12-1.el7.elrepo.x86_64.rpm
-rw-r--r-- 1 root root 12632052 Jan 18 10:59 kernel-ml-devel-4.19.12-1.el7.elrepo.x86_64.rpm
[root@localhost opt]# yum install ./*.rpm -y
...
Installed:kernel-ml.x86_64 0:4.19.12-1.el7.elrepo                                                  kernel-ml-devel.x86_64 0:4.19.12-1.el7.elrepoDependency Installed:perl.x86_64 4:5.16.3-299.el7_9            perl-Carp.noarch 0:1.26-244.el7                perl-Encode.x86_64 0:2.51-7.el7                    perl-Exporter.noarch 0:5.68-3.el7perl-File-Path.noarch 0:2.09-2.el7        perl-File-Temp.noarch 0:0.23.01-3.el7          perl-Filter.x86_64 0:1.49-3.el7                    perl-Getopt-Long.noarch 0:2.40-3.el7perl-HTTP-Tiny.noarch 0:0.033-3.el7       perl-PathTools.x86_64 0:3.40-5.el7             perl-Pod-Escapes.noarch 1:1.04-299.el7_9           perl-Pod-Perldoc.noarch 0:3.20-4.el7perl-Pod-Simple.noarch 1:3.28-4.el7       perl-Pod-Usage.noarch 0:1.63-3.el7             perl-Scalar-List-Utils.x86_64 0:1.27-248.el7       perl-Socket.x86_64 0:2.010-5.el7perl-Storable.x86_64 0:2.45-3.el7         perl-Text-ParseWords.noarch 0:3.29-4.el7       perl-Time-HiRes.x86_64 4:1.9725-3.el7              perl-Time-Local.noarch 0:1.2300-2.el7perl-constant.noarch 0:1.27-2.el7         perl-libs.x86_64 4:5.16.3-299.el7_9            perl-macros.x86_64 4:5.16.3-299.el7_9              perl-parent.noarch 1:0.225-244.el7perl-podlators.noarch 0:2.5.1-3.el7       perl-threads.x86_64 0:1.87-4.el7               perl-threads-shared.x86_64 0:1.43-6.el7Complete!
[root@localhost opt]#

5.更改内核启动顺序

[root@localhost ~]# grub2-set-default 0
[root@localhost ~]# grub2-mkconfig -o /etc/grub2.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.19.12-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-4.19.12-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1160.105.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.105.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1160.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-cf7d56908f2b4b73bc25710041bda25d
Found initrd image: /boot/initramfs-0-rescue-cf7d56908f2b4b73bc25710041bda25d.img
done
[root@localhost ~]#
[root@localhost ~]# grubby --args="user_namespace.enable=1" --update-kernel="$(grubby --default-kernel)"
[root@localhost ~]#

6.检查内核版本

[root@localhost ~]# grubby --default-kernel
/boot/vmlinuz-4.19.12-1.el7.elrepo.x86_64
[root@localhost ~]#

7.重启

[root@localhost ~]# reboot

8.再次检查内核版本

[root@localhost ~]# uname -a
Linux localhost.localdomain 4.19.12-1.el7.elrepo.x86_64 #1 SMP Fri Dec 21 11:06:36 EST 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]#

9.修改启动界面显示的内核顺序

  • 注释掉 3.10 内核
[root@localhost ~]# vim /etc/grub2.cfg### BEGIN /etc/grub.d/10_linux ###
menuentry 'CentOS Linux (4.19.12-1.el7.elrepo.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-4.19.12-1.el7.elrepo.x86_64-advanced-5620e84e-0e87-41ad-9913-5292a8fd1d5e' {load_videoset gfxpayload=keepinsmod gzioinsmod part_msdosinsmod xfsset root='hd0,msdos1'if [ x$feature_platform_search_hint = xy ]; thensearch --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  1556ccd1-3879-4b8e-8b23-80f8a473557felsesearch --no-floppy --fs-uuid --set=root 1556ccd1-3879-4b8e-8b23-80f8a473557ffilinux16 /vmlinuz-4.19.12-1.el7.elrepo.x86_64 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rhgb quiet user_namespace.enable=1initrd16 /initramfs-4.19.12-1.el7.elrepo.x86_64.img
}
# menuentry 'CentOS Linux (3.10.0-1160.105.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-1160.105.1.el7.x86_64-advanced-5620e84e-0e87-41ad-9913-5292a8fd1d5e' {
#       load_video
#       set gfxpayload=keep
#       insmod gzio
#       insmod part_msdos
#       insmod xfs
#       set root='hd0,msdos1'
#       if [ x$feature_platform_search_hint = xy ]; then
#         search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  1556ccd1-3879-4b8e-8b23-80f8a473557f
#       else
#         search --no-floppy --fs-uuid --set=root 1556ccd1-3879-4b8e-8b23-80f8a473557f
#       fi
#       linux16 /vmlinuz-3.10.0-1160.105.1.el7.x86_64 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rhgb quiet
#       initrd16 /initramfs-3.10.0-1160.105.1.el7.x86_64.img
# }
# menuentry '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-5620e84e-0e87-41ad-9913-5292a8fd1d5e' {
#       load_video
#       set gfxpayload=keep
#       insmod gzio
#       insmod part_msdos
#       insmod xfs
#       set root='hd0,msdos1'
#       if [ x$feature_platform_search_hint = xy ]; then
#         search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  1556ccd1-3879-4b8e-8b23-80f8a473557f
#       else
#         search --no-floppy --fs-uuid --set=root 1556ccd1-3879-4b8e-8b23-80f8a473557f
#       fi
#       linux16 /vmlinuz-3.10.0-1160.el7.x86_64 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rhgb quiet
#       initrd16 /initramfs-3.10.0-1160.el7.x86_64.img
# }
menuentry 'CentOS Linux (0-rescue-cf7d56908f2b4b73bc25710041bda25d) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-cf7d56908f2b4b73bc25710041bda25d-advanced-5620e84e-0e87-41ad-9913-5292a8fd1d5e' {load_videoinsmod gzioinsmod part_msdosinsmod xfsset root='hd0,msdos1'if [ x$feature_platform_search_hint = xy ]; thensearch --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  1556ccd1-3879-4b8e-8b23-80f8a473557felsesearch --no-floppy --fs-uuid --set=root 1556ccd1-3879-4b8e-8b23-80f8a473557ffilinux16 /vmlinuz-0-rescue-cf7d56908f2b4b73bc25710041bda25d root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rhgb quietinitrd16 /initramfs-0-rescue-cf7d56908f2b4b73bc25710041bda25d.img
}### END /etc/grub.d/10_linux ###
  • 重启
[root@localhost ~]# reboot

我们下期见,拜拜!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/649976.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Tree-Shaking 作用和实现原理

一、什么是Tree-shaking Tree-shaking 它的名字来源于通过摇晃(shake)JavaScript代码的抽象语法树(AST),是一种用于优化JavaScript代码的技术,主要用于移除未被使用的代码,使得最终生成的代码包…

大模型应用开发:为产品创建一个AI客服/智能助手

欢迎阅读本系列文章!我将带你一起探索如何使用OpenAI API来开发GPT大模型应用。无论你是编程新手还是资深开发者,都能在这里获得灵感和收获。 本文将继续展示AI助手的开发方式,在OpenAPI中它的名字是Assistants。 什么是Assistants&#xf…

Python网络爬虫实战——实验4:Python爬虫代理的使用

【实验内容】 本实验主要介绍在爬虫采集数据的过程中代理的使用。 【实验目的】 1、掌握代理使用的基本场景; 2、解决IP封锁问题; 3、提高爬虫访问效率; 【实验步骤】 步骤1选择代理服务提供商 步骤2配置爬虫使用代理 步骤3 采集数据生成…

Rust复合类型之元组

元组是一个有着固定(元素)长度的列表,每个元素的类型有可能是不同的。类型和元素都用小括号括起来,它们之间用逗号隔开。例如: fn main() { let itemname: (i32, f64, u8) (500, 6.4, 1); }元组可以使用.来访问其中的…

priority_queue模拟

文章目录 模拟priority_queue性质:成员函数:向上调整、向下调整push/pop/empty/top/size/empty成员变量 仿函数struct和class练习题堆的一些性质 模拟priority_queue 性质: 是容器适配器; 底层逻辑是堆,适配器是vect…

Android MVVM+Clean架构简介

本文主要介绍Android开发中MVVM Clean架构。 一、ViewModel ViewModel 类是一种业务逻辑或屏幕级状态容器。它用于将状态公开给界面,以及封装相关的业务逻辑。 它的主要优点是,它可以缓存状态,并可在配置更改后持久保留相应状态。这意味着在 …

音频筑基:窄带、宽带、超宽带、全带一次说透

音频筑基:窄带、宽带、超宽带、全带一次说透 窄带、宽带、超宽带、全带定义参考资料 音频信号中,经常遇到窄带、宽带等说法,本文进行一个小结归类。 窄带、宽带、超宽带、全带定义 窄带、宽带到全带,总体来说是,指对音…

Android JNI中设置全局的jbyteArray

在JNI的代码文件中声明一个全局变量,用来存储jbyteArray对象。你可以在JNI的头文件中定义该变量。 static jbyteArray globalByteArray;在JNI的某个函数中,将传递的jbyteArray对象赋值给全局变量。 JNIEXPORT void JNICALL Java_com_example_MyClass_set…

【遥感专题系列】影像信息提取之——基于专家知识的决策树分类

可以将多源数据用于影像分类当中,这就是专家知识的决策树分类器,本专题以ENVI中Decision Tree为例来叙述这一分类器。 本专题包括以下内容: 专家知识分类器概述知识(规则)定义ENVI中Decision Tree的使用 概述 基于知…

数据结构与算法——队列

概述 计算机科学中,queue 是以顺序的方式维护的一组数据集合,在一端添加数据,从另一端移除数据。添加的一端称为尾,移除的一端称为头。 功能 插入offer(value : E) : boolean  取值并移除poll() : E  取值peek() : E  判断…

LeetCode 40.组合总和 II

组合总和 II 给定一个候选人编号的集合 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。 candidates 中的每个数字在每个组合中只能使用 一次 。 注意:解集不能包含重复的组合。 方法一、回溯 由于题目要求解集…

实体识别与分类方法综述

目录 前言1 实体识别简介2 基于模板和规则的方法3 基于序列标注的方法3.1 常见序列标注模型3.2 模型参数估计和学习问题3.3 常见序列预测模型 4. 基于深度学习的实体识别方法5 基于预训练语言模型的实体识别5.1 BERT、GPT等预训练语言模型5.2 解码策略 6 特殊问题与挑战6.1 标签…

如何提高记忆力?

许多学员经常问我:为什么您的记忆力那么好?有没有什么方法,可以提高记忆力? 今天,我想好好聊聊这个问题。 当然,学习和记忆,是一个巨大的话题。这篇文章只是一个初探。希望能帮你打开一些视野&a…

关于java中static详解

关于java中static详解 我们接触static的时候不是在学习面向对象的时候接触的,是在学习方法的时候就有过接触,我们之前对static的了解只是静态的修饰,本篇文章我们对static这个修饰符做一个详细的理解😀。 static 如果在属性上&a…

深入理解Redis:如何设置缓存数据的过期时间及其背后的机制

目录 Redis 给缓存数据设置过期时间 Redis是如何判断数据是否过期的呢? 过期的数据的删除策略 Redis 内存淘汰机制 Redis 给缓存数据设置过期时间 一般情况下,我们设置保存的缓存数据的时候都会设置一个过期时间。为什么呢? 因为内存是有…

算法训练营Day48(动态规划9)

说明 今天就是打家劫舍的一天,这个系列不算难,可以一口气拿下。 198.打家劫舍 力扣(LeetCode)官网 - 全球极客挚爱的技术成长平台 class Solution:def rob(self, nums: List[int]) -> int:if len(nums) 0: # 如果没有房屋&a…

电流检测电路设计方案汇总

电流检测电路设计方案(一) 低端检流电路的检流电阻串联到地(图1),而高端检流电路的检流电阻是串联到高电压端(图2)。两种方法各有特点:低端检流方式在地线回路中增加了额外的线绕电…

​ElasticSearch

目录 简介 基本概念 倒排索引 FST 简介 ES是一个基于lucene构建的,分布式的,RESTful的开源全文搜索引擎。支持对各种类型的数据的索引;搜索速度快,可以提供实时的搜索服务;便于水平扩展,每秒可以处理 …

等保2.0 MySQL 5.7 配置修改

MySQL 5.7 等保2.0 配置修改 设置 connection_control 插件修改 root 用户名开启普通日志和二进制日志 设置 connection_control 插件 安装插件 # 登录数据库 mysql -u root -p# windows 下 INSTALL PLUGIN CONNECTION_CONTROL SONAME connection_control.dll INSTALL PLUGIN…

响应式Web开发项目教程(HTML5+CSS3+Bootstrap)第2版 例5-1事件处理

代码 <!doctype html> <html> <head> <meta charset"utf-8"> <title>事件处理</title> </head><body> <input id"btn" type"button" name"btn" value"提交" /> <…