当前位置:   article > 正文

Red Hat 8.5基于在线安装Docker及解决办法

Red Hat 8.5基于在线安装Docker及解决办法

第一步 检查版本号红帽7以下需要更新版本 不会的可以参考其他博主

还不会安装dockers嘛?亲手教会你在Red Hat 8.5安装docker以及万能的hello world_redhat安装docker什么版本-CSDN博客

uname -r

配置网络

vim /etc/sysconfig/network-scripts/ifcfg-ens160 
  1. TYPE=Ethernet
  2. PROXY_METHOD=none
  3. BROWSER_ONLY=no
  4. #BOOTPROTO=none
  5. BOOTPROTO=dhcp
  6. DEFROUTE=yes
  7. IPV4_FAILURE_FATAL=no
  8. IPV6INIT=yes
  9. IPV6_AUTOCONF=yes
  10. IPV6_DEFROUTE=yes
  11. IPV6_FAILURE_FATAL=no
  12. NAME=ens160
  13. UUID=b4db5cd7-7109-4b65-be9a-cb4005550313
  14. DEVICE=ens160
  15. ONBOOT=yes
  16. #IPADDR=192.168.200.1
  17. #PREFIX=24
  18. #DNS=192.168.200.1

ping www.baidu.com 测试连通性

第二步 根目录下建iso(iso可以自己命名)目录 ,配置yum仓库

  1. mkdir /iso
  2. mount /dev/cdrom /iso/
  3. mount /dev/cdrom /iso
  4. vim /etc/yum.repos.d/dvd.repo
  1. [BaseOS]
  2. name=BaseOS
  3. baseurl=file:///iso/BaseOS
  4. gpgcheck=0
  5. enabled=1
  6. [AppStream]
  7. name=AppStream
  8. baseurl=file:///iso/AppStream
  9. gpgcheck=0
  10. enabled=1

第三步 配置安装环境

防火墙关闭

  1. systemctl stop firewalld
  2. systemctl disable firewalld

(1)安装 gcc

yum install gcc –y  

(2)安装 gcc-c++

yum install gcc-c++ -y

(3)安装 yum-utils

 yum install -y yum-utils

故障排除(若配置无问题请跳过)

  1. 故障示范
  2. [root@localhost ~]# sudo yum update
  3. 正在更新 Subscription Management 软件仓库。
  4. 无法读取客户身份
  5. 本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
  6. BaseOS                                          0.0 B/s |   0 B     00:00    
  7. Errors during downloading metadata for repository 'BaseOS':
  8.  - Curl error (37): Couldn't read a file:// file for file:///ios/BaseOS/repodata/repomd.xml [Couldn't open file /ios/BaseOS/repodata/repomd.xml]
  9. 错误:为仓库 'BaseOS' 下载元数据失败 : Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
  10. 成功安装gcc软件包了。如果您遇到任何问题,请随时告诉我。
  11. 正在注册到:subscription.rhsm.redhat.com:443/subscription
  12. 用户名: CJ_john
  13. 密码:
  14. 这个系统已使用 ID b52d07ba-6eee-46fb-ae33-cc795282203c 进行了注册
  15. 注册的系统名是:localhost.localdomain
  16. [root@localhost iso]# subscription-manager status
  17. +-------------------------------------------+
  18.   系统状态详情
  19. +-------------------------------------------+
  20. 总体状态:禁用
  21. 内容访问模式设置为简单内容访问。无论订阅状态如何,该主机都可以访问内容。
  22. 系统目的状态:禁用
  23. [root@localhost iso]# yum install gcc -y
  24. 正在更新 Subscription Management 软件仓库。
  25. Repository AppStream is listed more than once in the configuration
  26. Repository BaseOS is listed more than once in the configuration
  27. Repository AppStream is listed more than once in the configuration
  28. BaseOS                                          0.0 B/s |   0 B     00:00    
  29. Errors during downloading metadata for repository 'BaseOS':
  30.  - Curl error (37): Couldn't read a file:// file for file:///ios/BaseOS/repodata/repomd.xml [Couldn't open file /ios/BaseOS/repodata/repomd.xml]
  31. 错误:为仓库 'BaseOS' 下载元数据失败 : Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
  32. [root@localhost iso]#
  33. [root@localhost iso]# subscription-manager attach --auto
  34. 忽略自动附加的请求。 因为内容访问模式的设置 ,组织“ 18111461”禁用了这个功能。
  35. [root@localhost iso]#
  36. [root@localhost iso]# subscription-manager list --available
  37. +-------------------------------------------+
  38.   可用订阅
  39. +-------------------------------------------+
  40. 订阅名称: Red Hat Beta Access
  41. 提供:     Red Hat Satellite Capsule Beta
  42.           Red Hat Enterprise Linux for SAP Applications for IBM z Systems Beta
  43.           Red Hat Enterprise Linux for SAP Applications for Power, little
  44.           endian Beta
  45.           Red Hat Enterprise Linux Fast Datapath Beta for Power, little endian
  46.           Red Hat Enterprise Linux Resilient Storage Beta
  47.           Red Hat Enterprise Linux for SAP Applications for x86_64 Beta
  48.           Red Hat CodeReady Linux Builder for IBM z Systems Beta
  49.           Red Hat Enterprise Linux for SAP HANA for x86_64 Beta
  50.           Red Hat Enterprise Linux Advanced Virtualization Beta (for RHEL
  51.           Server for IBM System Z)
  52.           Red Hat CodeReady Linux Builder for x86_64 Beta
  53.           Red Hat Enterprise Linux for SAP HANA for Power, little endian Beta
  54.           Red Hat Directory Server Beta
  55.           Red Hat Enterprise Linux for Power, little endian Beta
  56.           Red Hat Certificate System Beta
  57.           Red Hat Enterprise Linux for Real Time for NFV Beta
  58.           Red Hat Enterprise Linux for Real Time Beta
  59.           Red Hat Satellite Beta
  60.           Red Hat Enterprise Linux Fast Datapath Beta for x86_64
  61.           Red Hat Enterprise Linux for x86_64 Beta
  62.           Red Hat Enterprise Linux for IBM z Systems Beta
  63.           Red Hat Enterprise Linux for ARM 64 Beta
  64.           Red Hat CodeReady Linux Builder for ARM 64 Beta
  65.           Red Hat CodeReady Linux Builder for Power, little endian Beta
  66.           Red Hat Enterprise Linux High Availability Beta
  67. SKU:     RH00069
  68. 合同:    
  69. 池子 Id: 2c94699b8f35e63c018f56f2b0b31e39
  70. 提供管理: 否
  71. 可用:     无限
  72. 推荐的:   1
  73. 服务类型: L1-L3
  74. 角色:    
  75. 服务等级: Self-Support
  76. 使用方法:
  77. 附加组件:
  78. 订阅类型: Standard
  79. 开始:     20240508
  80. 结束:     20250508
  81. 权利类型: 物理的
  82. 订阅名称: Red Hat Developer Subscription for Individuals
  83. 提供:     Red Hat Enterprise Linux Fast Datapath
  84.           Red Hat OpenShift Enterprise JBoss EAP add-on Beta
  85.           Red Hat Ansible Automation Platform
  86.           Red Hat OpenShift Workload Availability
  87.           Red Hat Enterprise Linux Server
  88.           dotNET on RHEL (for RHEL Server)
  89.           Red Hat 3scale API Management Platform
  90.           OpenShift Developer Tools and Services
  91.           Red Hat CodeReady Linux Builder for ARM 64
  92.           Custom Metric Autoscaler
  93.           Red Hat Enterprise Linux Atomic Host Beta
  94.           Red Hat Container Images
  95.           Red Hat OpenShift Container Platform for ARM 64
  96.           Red Hat OpenShift Container Platform
  97.           Red Hat Enterprise Linux Resilient Storage for IBM z Systems -
  98.           Extended Update Support
  99.           Red Hat OpenShift GitOps for ARM 64
  100.           Red Hat CoreOS Beta
  101.           OpenJDK Java (for Middleware)
  102.           Red Hat Enterprise Linux for SAP Solutions for x86_64 - Extended
  103.           Update Support
  104.           Red Hat Enterprise Linux for SAP Applications for x86_64 - Update
  105.           Services for SAP Solutions
  106.           Red Hat Enterprise Linux Atomic Host
  107.           Red Hat Enterprise Linux High Availability (for IBM z Systems) -
  108.           Extended Update Support
  109.           Red Hat Enterprise Linux High Availability for x86_64 - Extended
  110.           Update Support
  111.           Network Observability (NETOBSERV)
  112.           Red Hat Developer Toolset (for RHEL Server)
  113.           Red Hat Enterprise Linux for SAP Solutions for x86_64
  114.           Red Hat Enterprise Linux for SAP Applications for Power LE - Update
  115.           Services for SAP Solutions
  116.           JBoss Enterprise Web Server from RHUI
  117.           Red Hat Software Collections (for RHEL Server)
  118.           Red Hat OpenShift distributed tracing
  119.           Red Hat Ansible Engine
  120.           MRG Realtime
  121.           Red Hat Enterprise Linux for x86_64 - Update Services for SAP
  122.           Solutions
  123.           JBoss Enterprise Application Platform from RHUI
  124.           Red Hat Developer Tools Beta (for RHEL Server)
  125.           Red Hat Software Collections Beta (for RHEL Server)
  126.           Red Hat Enterprise Linux for IBM z Systems - Extended Update Support
  127.           Red Hat Enterprise Linux for ARM 64
  128.           Red Hat OpenShift Enterprise JBoss EAP add-on
  129.           Red Hat EUCJP Support (for RHEL Server) - Extended Update Support
  130.           JBoss Enterprise Web Platform
  131.           Red Hat Enterprise Linux for SAP Applications for x86_64 - Extended
  132.           Update Support
  133.           Red Hat OpenShift Application Runtimes Beta
  134.           Red Hat Migration Toolkit
  135.           Red Hat Enterprise Linux Scalable File System (for RHEL Server)
  136.           Red Hat Container Native Virtualization for ARM 64
  137.           Red Hat Enterprise Linux Fast Datapath Beta (for RHEL for ARM 64)
  138.           Red Hat Enterprise Linux for x86_64 - Extended Update Support
  139.           Red Hat Container Native Virtualization
  140.           Red Hat Beta
  141.           Red Hat Openshift Serverless
  142.           Red Hat Enterprise Linux EUS Compute Node
  143.           Red Hat Enterprise Linux for x86_64
  144.           Red Hat Developer Tools (for RHEL Server for ARM)
  145.           Red Hat CodeReady Linux Builder for ARM 64 - Extended Update Support
  146.           Red Hat CoreOS
  147.           Red Hat CodeReady Linux Builder for x86_64
  148.           Red Hat Enterprise Linux High Performance Networking (for RHEL
  149.           Compute Node)
  150.           Oracle Java (for RHEL Server)
  151.           Red Hat Enterprise Linux High Performance Networking (for RHEL
  152.           Server) - Extended Update Support
  153.           Red Hat CodeReady Linux Builder for x86_64 - Extended Update Support
  154.           Red Hat JBoss AMQ Clients
  155.           Red Hat JBoss Data Grid
  156.           Red Hat Software Collections (for RHEL Server for ARM)
  157.           Kernel Module Management
  158.           Red Hat Openshift Application Runtimes
  159.           Red Hat Enterprise Linux Fast Datapath (for RHEL for ARM 64)
  160.           Red Hat Enterprise Linux High Availability for x86_64
  161.           Run Once Duration Override Operator
  162.           Red Hat Developer Tools Beta (for RHEL Server for ARM)
  163.           Red Hat JBoss Core Services from RHUI
  164.           Red Hat build of Quarkus
  165.           Red Hat Service Interconnect
  166.           Red Hat Enterprise Linux Load Balancer (for RHEL Server)
  167.           Red Hat JBoss Middleware
  168.           Red Hat CodeReady Workspaces for OpenShift
  169.           Red Hat OpenShift Enterprise Client Tools
  170.           Red Hat AMQ Interconnect
  171.           Red Hat Enterprise Linux High Performance Networking (for RHEL
  172.           Server)
  173.           dotNET on RHEL Beta (for RHEL Server)
  174.           Red Hat Developer Suite v.3
  175.           Red Hat OpenShift Builds for ARM
  176.           Red Hat Openshift Application Runtimes for IBM Power LE
  177.           Red Hat Enterprise Linux for ARM 64 - Extended Update Support
  178.           Red Hat Container Images Beta
  179.           Red Hat Developer Tools (for RHEL Server)
  180.           Red Hat Software Collections Beta (for RHEL Server for ARM)
  181.           Oracle Java (for RHEL Server) - Extended Update Support
  182.           Red Hat Enterprise Linux for SAP Solutions for x86_64 - Update
  183.           Services for SAP Solutions
  184.           Red Hat S-JIS Support (for RHEL Server) - Extended Update Support
  185.           Red Hat CodeReady Linux Builder for IBM z Systems - Extended Update
  186.           Support
  187.           Red Hat Enterprise Linux Load Balancer (for RHEL Server) - Extended
  188.           Update Support
  189.           Red Hat Enterprise Linux Fast Datapath Beta for x86_64
  190.           Red Hat Developer Hub
  191.           Red Hat OpenShift Pipelines
  192.           Cert Manager support for Red Hat OpenShift release
  193.           Red Hat OpenShift Enterprise JBoss A-MQ add-on
  194.           Red Hat OpenShift Pipelines for ARM
  195.           Red Hat OpenShift GitOps
  196.           Secondary Scheduler Operator for Red Hat OpenShift (OSSO)
  197.           Red Hat Enterprise Linux Scalable File System (for RHEL Server) -
  198.           Extended Update Support
  199.           Red Hat Enterprise Linux for Real Time
  200.           Red Hat Enterprise Linux High Availability for x86_64 - Update
  201.           Services for SAP Solutions
  202.           Red Hat OpenShift Enterprise JBoss FUSE add-on
  203.           JBoss Enterprise Application Platform
  204.           Red Hat Enterprise Linux for SAP Applications for x86_64
  205.           Red Hat JBoss Core Services
  206.           Red Hat Enterprise Linux Resilient Storage for x86_64 - Extended
  207.           Update Support
  208.           Red Hat Quay Enterprise
  209.           Red Hat Enterprise Linux Resilient Storage for x86_64
  210.           Red Hat Container Development Kit
  211.           Red Hat OpenShift Builds
  212. SKU:     RH00798
  213. 合同:    
  214. 池子 Id: 2c94699b8f35e63c018f56f2b0bd1e3b
  215. 提供管理: 否
  216. 可用:     16
  217. 推荐的:   1
  218. 服务类型:
  219. 角色:     RHEL Server
  220.           RHEl Workstation
  221. 服务等级: Self-Support
  222. 使用方法: Development/Test
  223. 附加组件:
  224. 订阅类型: Standard
  225. 开始:     20240508
  226. 结束:     20250508
  227. 权利类型: 物理的
  228. [root@localhost iso]# subscription-manager attach --pool=<Subscription_ID>
  229. bash: 未预期的符号 `newline' 附近有语法错误
  230. [root@localhost iso]# subscription-manager attach --pool=<Subscription_ID>
  231. bash: 未预期的符号 `newline' 附近有语法错误
  232. [root@localhost iso]#
  233. [root@localhost iso]# subscription-manager attach --pool=2c94699b8f35e63c018f56f2b0bd1e3b
  234. You must first accept Red Hat's Terms and conditions. Please visit https://www.redhat.com/wapps/tnc/ackrequired?site=candlepin&event=attachSubscription
  235. [root@localhost iso]# subscription-manager attach --auto
  236. 忽略自动附加的请求。 因为内容访问模式的设置 ,组织“ 18111461”禁用了这个功能。
  237. [root@localhost iso]# yum install gcc -y
  238. 正在更新 Subscription Management 软件仓库。
  239. Repository AppStream is listed more than once in the configuration
  240. Repository BaseOS is listed more than once in the configuration
  241. Repository AppStream is listed more than once in the configuration
  242. BaseOS                                          0.0 B/s |   0 B     00:00    
  243. Errors during downloading metadata for repository 'BaseOS':
  244.  - Curl error (37): Couldn't read a file:// file for file:///ios/BaseOS/repodata/repomd.xml [Couldn't open file /ios/BaseOS/repodata/repomd.xml]
  245. 错误:为仓库 'BaseOS' 下载元数据失败 : Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
  246. [root@localhost iso]#

免费注册红帽用于获取下载权限

https://www.redhat.com/wapps/ugc/register.html

具体操作参考其他博主

Red Hat Subscription 开发者订阅与激活订阅_redhat开发者订阅-CSDN博客

免费注册 Redhat 开发者订阅和激活订阅_红帽合作伙伴如何订阅-CSDN博客

  1. 切换根权限

    sudo su

  2. 运行以下命令开始系统注册过程

    subscription-manager register

  3. 按照提示输入您的Red Hat订阅信息,包括用户名和密码。如果您还没有Red Hat订阅,请先获取一个有效的订阅。

  4. 注册成功后,您应该会收到一条消息确认系统已成功注册

  5. 可以使用以下命令来验证系统的订阅状态:

    subscription-manager status

  6. 运行以下命令激活系统:

    subscription-manager attach --auto

  7. 然后再次运行subscription-manager status命令,确保系统状态已激活

  8. 查看可用的订阅列表:

    subscription-manager list --available
  9. 手动选择一个订阅并附加它。您可以使用以下命令,将<Subscription_ID>替换为您选择的订阅的ID:

    subscription-manager attach --pool=(修改为自己的ID)2c94699b8f35e63c018f56f2b0bd1e3b

  10. 确保订阅已成功附加:

    subscription-manager list --consumed

  11. 最后再次运行subscription-manager status命令,确保系统状态已激活

  12. 注册红帽以后的问题

    1. [root@localhost iso]# subscription-manager attach --auto
    2. 忽略自动附加的请求。 因为内容访问模式的设置 ,组织“ 18111461”禁用了这个功能。
    3. [root@localhost iso]# yum install gcc -y
    4. 正在更新 Subscription Management 软件仓库。
    5. Repository AppStream is listed more than once in the configuration
    6. Repository BaseOS is listed more than once in the configuration
    7. Repository AppStream is listed more than once in the configuration
    8. BaseOS 0.0 B/s | 0 B 00:00
    9. Errors during downloading metadata for repository 'BaseOS':
    10. - Curl error (37): Couldn't read a file:// file for file:///ios/BaseOS/repodata/repomd.xml [Couldn't open file /ios/BaseOS/repodata/repomd.xml]
    11. 错误:为仓库 'BaseOS' 下载元数据失败 : Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
    12. [root@localhost iso]#
    13. 解决办法

    清理存储库缓存:

    yum clean all 

    重新生成存储库缓存:

     yum makecache

    再次尝试安装gcc软件包:

    yum install gcc -y

  13. 以上解决办法都无法处理当前问题

    请参考其他博主

    【完美解决】【Centos8】Linux 为 repo ‘AppStream‘ 下载元数据失败、Could not resolve host: mirrors.cloud.aliyuncs.com_alimalinux下载元数据失败-CSDN博客

    然后顺序执行
    
    1. yum clean all
    2. yum makecache
    3. yum install gcc -y

    第四步

    停用之前所配置的yum源,并清理缓存

    1. mv redhat.repo redhat.repo.bak
    2. yum clean all

    卸载默认的 pomdman (红帽默认的容器)

    yum remove pomdman

    添加新的 yum 源(以阿里云地址为例)

    yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

    更新 yum 软件包索引

     yum makecache

    安装 docker 替换 红帽基础上安装需要

    yum install docker-ce --allowerasing

    安装依赖包

    yum install -y libseccomp-devel

    检测

    docker -v

    启动 docker

    systemctl start docker

    查看 docker 版本(包括 C端和 S 端)

    docker version

    查看状态

    systemctl status docker

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/576094
推荐阅读
相关标签
  

闽ICP备14008679号