跨cpu架构部署容器技术点:怎样修改Linux 的内核版本

在使用Docker 进行跨平台部署之后,我们还可以尝试进行跨架构部署。
从X86 架构上移植到 aarch64 上。
要使用这个功能,需要Docker 的版本在19以上,因为这个是19以上版本中提供的一个实验性方案。
除此之外还需要:Linux的内核版本要在4.X版本以上,
否则的话,会出现错误,特别是 centOS 用户。

这一节讲述的内容就是如何在centOS 用户中修改Linux内核。
以下是具体步骤


1. 检查当前版本

检查当前内核版本是否在4.X版本以上,如果是,请直接跳转第三步 测试DOCKER buildx[4]插件使用是否正常


检查方式

uname -a

实操

[root@master ~]# uname -aLinux master 3.10.0-1160.92.1.el7.x86_64 #1 SMP Tue Jun 20 11:48:01 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

查看方式

查看 Linux master 之后的内容,数字是版本号,紧随其后的是cpu架构。
以上述内容为例:

  • 版本号是 3.10.0-1160.92.1.el7 最开始的 3 是大版本号,而我们所要求的 4.x 就是指 要使用大版本号为4 的内核版本。
  • x86_64就是指 系统采用 x86架构 64位 计算机操作系统。

2. 升级内核版本

2.1 升级方式

本次升级,我们采用使用内核文件本地升级的方式进行操作,
具体分为六部分: 创建存放内核文件的分区(文件夹)、下载内核、安装内核、更改内核启动顺序、检查默认内核版本、重启后检查内核版本

以下为分步骤详述:

2.1.1 创建内核文件的存放地址

这里我们通常建议:采用 /opt/下存储。或者 /root/下存储,前者采用Linux 管理方式, 后者采用管理员管理方式,不建议随意存放,或者放在非管理员用户下。

这里采用 /opt/kernel目录。

mkdir -p /opt/kernel

2.1.2 下载内核

这里采用 从指定网址下载,如果你的服务器不能链接外网,后续我会把内核文件的百度网盘链接更新在此处,可以直接下载文件传输到服务器上。

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

2.1.3 安装内核

cd /opt/kernel && yum localinstall -y kernel-ml\*

注意:当使用关键词查找方式不能找到安装,提示Nothing to do时,可以指定位置,依次安装。

过程如下

  • 问题展示:
[root@master kernel]# cd /opt/kernel && yum localinstall -y kernel-ml\*Loaded plugins: fastestmirror, langpacksRepository base is listed more than once in the configurationRepository updates is listed more than once in the configurationRepository extras is listed more than once in the configurationRepository centosplus is listed more than once in the configurationSkipping: kernel-ml*, filename does not end in .rpm.Nothing to do
  • 实际情况
[root@master kernel]# ls
kernel-ml-4.19.12-1.el7.elrepo.x86_64.rpm  kernel-ml-devel-4.19.12-1.el7.elrepo.x86_64.rpm
  • 解决方式
[root@master kernel]# yum localinstall -y kernel-ml-4.19.12-1.el7.elrepo.x86_64.rpm
[root@master kernel]#  yum localinstall -y kernel-ml-devel-4.19.12-1.el7.elrepo.x86_64.rpm

2.1.4 更改内核启动顺序

[root@master kernel]# grub2-set-default 0 && 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.92.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.92.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1160.90.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.90.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1160.88.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.88.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-693.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-01c8d25d03ff48abbbe893b5100e4d2d
Found initrd image: /boot/initramfs-0-rescue-01c8d25d03ff48abbbe893b5100e4d2d.img
done

2.1.5 检查默认内核是不是 4.19

这里是因为我安装的版本是 4.19.12 如果你使用的是其他版本,请自行变更。

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

2.1.6 重启后检查内核版本是不是4.19

重启服务器

[root@master kernel] reboot 

检查版本

[root@master ~]# uname -a
Linux master 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

2.2 常见错误记录

在使用 4.x 以下内核的版本时,Docker 的 Bulidx[4] 插件使用时会提示报错的
其中常出现错误展示

注意:使用账户为root

  • 错误一
[root@master ~]# docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d
Unable to find image 'docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d' locally
66f9012c56a8316f9244ffd7622d7c21c1f6f28d: Pulling from docker/binfmt
1537944798a7: Pull complete
2e6cfc71c612: Pull complete
e4893eb1e1de: Pull complete
Digest: sha256:4f7c8d7fc9ec599be42e3d4587cb1bd9baa6e548d540cddd50fabaa7ff966041
Status: Downloaded newer image for docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d
2023/07/26 08:01:55 Cannot write to /proc/sys/fs/binfmt_misc/register: write /proc/sys/fs/binfmt_misc/register: invalid argument
  • 错误二
[root@master ~]# docker run --rm -t arm64v8/ubuntu uname -m
Unable to find image 'arm64v8/ubuntu:latest' locally
latest: Pulling from arm64v8/ubuntu
a39c84e173f0: Pull complete
Digest: sha256:26c3bd3ae441c873a210200bcbb975ffd2bbf0c0841a4584f4476c8a5b8f3d99
Status: Downloaded newer image for arm64v8/ubuntu:latest
WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64/v3) and no specific platform was requested exec /usr/bin/uname: exec format error
  • 错误三
[root@master ~]# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
Unable to find image 'multiarch/qemu-user-static:latest' locally
latest: Pulling from multiarch/qemu-user-static
01c2cdc13739: Pull complete
11933eee4160: Pull complete
30abb83a18eb: Pull complete
0657daef200b: Pull complete
10094524a9f3: Pull complete
Digest: sha256:2c8b8fcf1d6badfca797c3fb46b7bb5f705ec7e66363e1cfeb7b7d4c7086e360
Status: Downloaded newer image for multiarch/qemu-user-static:latest
Setting /usr/bin/qemu-alpha-static as binfmt interpreter for alpha
sh: write error: Invalid argument
sh: write error: Invalid argument
Setting /usr/bin/qemu-arm-static as binfmt interpreter for arm
Setting /usr/bin/qemu-armeb-static as binfmt interpreter for armeb
sh: write error: Invalid argument
Setting /usr/bin/qemu-sparc-static as binfmt interpreter for sparc
sh: write error: Invalid argument
sh: write error: Invalid argument
Setting /usr/bin/qemu-sparc32plus-static as binfmt interpreter for sparc32plus
sh: write error: Invalid argument
Setting /usr/bin/qemu-sparc64-static as binfmt interpreter for sparc64
sh: write error: Invalid argument
Setting /usr/bin/qemu-ppc-static as binfmt interpreter for ppc
Setting /usr/bin/qemu-ppc64-static as binfmt interpreter for ppc64
sh: write error: Invalid argument
Setting /usr/bin/qemu-ppc64le-static as binfmt interpreter for ppc64le
sh: write error: Invalid argument
Setting /usr/bin/qemu-m68k-static as binfmt interpreter for m68k
sh: write error: Invalid argument
Setting /usr/bin/qemu-mips-static as binfmt interpreter for mips
sh: write error: Invalid argument
Setting /usr/bin/qemu-mipsel-static as binfmt interpreter for mipsel
sh: write error: Invalid argument
sh: write error: Invalid argument
Setting /usr/bin/qemu-mipsn32-static as binfmt interpreter for mipsn32
sh: write error: Invalid argument
Setting /usr/bin/qemu-mipsn32el-static as binfmt interpreter for mipsn32el
Setting /usr/bin/qemu-mips64-static as binfmt interpreter for mips64
sh: write error: Invalid argument
sh: write error: Invalid argument
Setting /usr/bin/qemu-mips64el-static as binfmt interpreter for mips64el
Setting /usr/bin/qemu-sh4-static as binfmt interpreter for sh4
sh: write error: Invalid argument
Setting /usr/bin/qemu-sh4eb-static as binfmt interpreter for sh4eb
sh: write error: Invalid argument
sh: write error: Invalid argument
Setting /usr/bin/qemu-s390x-static as binfmt interpreter for s390x
sh: write error: Invalid argument
Setting /usr/bin/qemu-aarch64-static as binfmt interpreter for aarch64
sh: write error: Invalid argument
Setting /usr/bin/qemu-aarch64_be-static as binfmt interpreter for aarch64_be
Setting /usr/bin/qemu-hppa-static as binfmt interpreter for hppa
sh: write error: Invalid argument
Setting /usr/bin/qemu-riscv32-static as binfmt interpreter for riscv32
sh: write error: Invalid argument
Setting /usr/bin/qemu-riscv64-static as binfmt interpreter for riscv64
sh: write error: Invalid argument
Setting /usr/bin/qemu-xtensa-static as binfmt interpreter for xtensa
sh: write error: Invalid argument
Setting /usr/bin/qemu-xtensaeb-static as binfmt interpreter for xtensaeb
sh: write error: Invalid argument
Setting /usr/bin/qemu-microblaze-static as binfmt interpreter for microblaze
sh: write error: Invalid argument
Setting /usr/bin/qemu-microblazeel-static as binfmt interpreter for microblazeel
sh: write error: Invalid argument
Setting /usr/bin/qemu-or1k-static as binfmt interpreter for or1k
sh: write error: Invalid argument
Setting /usr/bin/qemu-hexagon-static as binfmt interpreter for hexagon
sh: write error: Invalid argument

3. 测试Docker 的**buildx[4]**插件使用是否正常

[root@master ~]# docker buildx ls 
NAME/NODE    DRIVER/ENDPOINT             STATUS         PLATFORMS
mybuilder *  docker-container            mybuilder0       unix:///var/run/docker.sock running linux/amd64, linux/arm64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6
default      dockerdefault    default                     running linux/amd64, linux/386

无告警和报错内容,正常使用。

4. 总结

至此,完成更改。


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

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

相关文章

uni-app-使用tkiTree组件实现树形结构选择

前言 在实际开发中我们经常遇见树结构-比如楼层区域-组织架构-部门岗位-系统类型等情况 往往需要把这个树结构当成条件来查询数据,在PC端可以使用Tree,table,Treeselect等组件展示 在uni-app的内置组件中似乎没有提供这样组件来展示&#x…

并查集模板的应用:连通块

一、链接 837. 连通块中点的数量 二、题目 给定一个包含 nn 个点(编号为 1∼n1∼n)的无向图,初始时图中没有边。 现在要进行 mm 个操作,操作共有三种: C a b,在点 aa 和点 bb 之间连一条边&#xff0c…

Windows server上用nginx部署vue3项目

Windows server上用nginx部署vue3项目 一、Node中node_modules文件夹及package.json文件的作用说明二、VUE3项目打包三、Windows Server上的Nginx部署 一、Node中node_modules文件夹及package.json文件的作用说明 node_modules是安装node后用来存放用包管理工具下载安装的包的…

快速消除视频的原声的技巧分享

网络上下载的视频都会有视频原声或者背景音乐,如果不喜欢并且想更换新的BGM要怎么操作呢?今天小编就来教你如何快速给多个视频更换新的BGM,很简单,只需要将原视频的原声快速消音同时添加新的背景音频就行,一起来看看详…

设计模式行为型——中介者模式

目录 什么是中介者模式 中介者模式的实现 中介者模式角色 中介者模式类图 中介者模式代码实现 中介者模式的特点 优点 缺点 使用场景 注意事项 实际应用 什么是中介者模式 中介者模式(Mediator Pattern)属于行为型模式,是用来降低…

CVE漏洞复现-CVE-2019-5021 镜像漏洞利用

CVE-2019-5021 镜像漏洞利用 随着容器技术的普及,容器镜像也成为软件供应链中非常重要的一个组成的部分。人们像使用 pip 等工具从仓库获取各种编程软件库一样,可以从 Docker Hub 或 第三方仓库拉取镜像,在其基础上进行开发,从而…

adb调试

连不上 adb 如果还遇到5037端口被占用的问题,就找出进程号用taskkill命令杀死该进程即可 1、查找5037端口对应的进程:netstat -ano|findstr 5037 2、杀死该进程:taskkill /F /PID pid 连接unity profiler 打开发包,并安装在手机…

【2023年11月第四版教材】《第2章-信息技术发展》

《第2章-信息技术发展》 章节说明1 计算机软硬件2 计算机网络2.1 网络的作用范围2.2 OSI模型2.3 广域网协议2.4 网络协议2.5 TCP/IP2.6 软件定义网络(SDN)2.7 第五代移动通信技术 章节说明 大部分为新增内容,预计选择题考4分,案例…

网络音频终端音频编码解码终端

网络对讲终端SV-7011V 网络对讲终端SV-7011V,采用了ARM音频DSP架构,集网络对讲、网络广播、监听等功能于一身,内置麦克风、配置line out、line in、Mic in功能输出接口,适用于学校,机场,广场等场所。 产品…

保姆级教程--抢先体验 Microsoft 365 Copilot,微软全家桶Chat GPT

【ChatGPT】前些天发现了一个巨牛的人工智能学习电子书,通俗易懂,风趣幽默,无广告,忍不住分享一下给大家。(点击查看学习资料) 前段时间微软发的Microsoft 365 Copilot 可以说非常火爆了,那么该…

元素2D转3D 椭圆形旋转实现

椭圆旋转功能展示 transform-style: preserve-3d;(主要css代码) gif示例(背景图可插入透明以此实现边框线的旋转) 导致的无法点击遮挡问题可以参考我的另一个文章 穿透属性-----------------------css穿透属性 实时代码展示

决策树的划分依据之:信息增益率

在上面的介绍中,我们有意忽略了"编号"这一列.若把"编号"也作为一个候选划分属性,则根据信息增益公式可计算出它的信息增益为 0.9182,远大于其他候选划分属性。 计算每个属性的信息熵过程中,我们发现,该属性的值为0, 也就…

Redis 双写一致性实践及案例

面试问题: 你只要用缓存,就可能会涉及到redis缓存与数据库双存储双写,你只要是双写,就一定会有数据一致性的问题,那么你如何解决一致性问题?双写一致性,你先动缓存redis还是数据库mysql哪一个&…

解决word打字卡顿问题的方法

❤ 2023.8.5 ❤ 最近整理论文,本来我是wps死忠粉,奈何wps不支持latex公式。。。 无奈用起了word,但是谁想字数稍微多了一点,word就卡得欲仙欲死,打个字过去2s才显示出来,删除的时候都不知道自己删了几个字…

代码随想录算法训练营之JAVA|第二十一天| 77. 组合

今天是第21天刷leetcode,立个flag,打卡60天。 算法挑战链接 77. 组合https://leetcode.cn/problems/combinations/description/ 第一想法 需要从N个数中选取K个数,那么第一想法肯定是k个for循环,每个for循环选取一个数&#x…

尚品汇总结三:商城首页(面试专用)

目录 首页商品分类实现 1、封装数据接口 2、页面静态化: 什么是页面静态化 为什么要使用静态化 首页商品分类实现 前面做了商品详情,我们现在来做首页分类,我先看看京东的首页分类效果,我们如何实现类似效果: 思路…

MongoDB 使用总结

🍓 简介:java系列技术分享(👉持续更新中…🔥) 🍓 初衷:一起学习、一起进步、坚持不懈 🍓 如果文章内容有误与您的想法不一致,欢迎大家在评论区指正🙏 🍓 希望这篇文章对你有所帮助,欢…

pktgen-dpdk arm编译问题 “Platform must be built with RTE_FORCE_INTRINSICS“

编译报错 /usr/include/rte_atomic_32.h:9:4: error: #error Platform must be built with RTE_FORCE_INTRINSICS解决办法: 我是在 arm架构服务器上编译出现这个,要定义 RTE_FORCE_INTRINSICS 在meson.build中 增加gcc编译参数 add_project_arguments(…

Shell编程基础(十二)函数

函数 概念定义调用函数综合脚本 概念 和其他编程语言一样,函数作为一种封装代码块,以提高代码复用性和可维护性的存在。 记住一点,先定义,再使用 定义 shell 函数的创建方式 function 函数名 空格{ xxxx return 返回码&#x…

【ASP.NET MVC】使用动软(四)(12)

一、筛选器类和Cookie实现路由 需解决的问题: 网站登录往往需要用户名密码验证,为避免重复验证,一般采用Cookie 、Session等技术来保持用户的登录状态: Session是在服务端保存的一个数据结构,用来跟踪用户的状态&…