当前位置:   article > 正文

Linux(CentOS) Docker 安装与配置(报错总结)_yum install -y yum-utils出错

yum install -y yum-utils出错

前言:(步骤)

  1. # 安装 docker
  2. yum install -y yum-utils
  3. yum-config-manager \
  4. --add-repo \
  5. https://download.docker.com/linux/centos/docker-ce.repo
  6. yum install -y docker-ce docker-ce-cli containerd.io
  7. # 启动 docker。
  8. systemctl start docker

一、centos8执行yum install -y yum-utils出错

[root@localhost ~]# yum install -y yum-utils
CentOS-8 - AppStream                             25  B/s |  38  B     00:01    
CentOS-8 - Base                                  69  B/s |  38  B     00:00    
Failed to synchronize cache for repo 'AppStream', ignoring this repo.
Failed to synchronize cache for repo 'BaseOS', ignoring this repo.
Last metadata expiration check: 0:11:10 ago on Mon 20 May 2024 06:26:45 AM PDT.
No match for argument: yum-utils
Error: Unable to find a match

①正确解决步骤:
1.#进入配置文件目录

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ll
total 44
-rw-r--r--. 1 root root  731 Aug 13  2019 CentOS-AppStream.repo
-rw-r--r--. 1 root root  712 Aug 13  2019 CentOS-Base.repo
-rw-r--r--. 1 root root  798 Aug 13  2019 CentOS-centosplus.repo
-rw-r--r--. 1 root root 1320 Aug 13  2019 CentOS-CR.repo
-rw-r--r--. 1 root root  668 Aug 13  2019 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  756 Aug 13  2019 CentOS-Extras.repo
-rw-r--r--. 1 root root  338 Aug 13  2019 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  928 Aug 13  2019 CentOS-Media.repo
-rw-r--r--. 1 root root  736 Aug 13  2019 CentOS-PowerTools.repo
-rw-r--r--. 1 root root 1382 Aug 13  2019 CentOS-Sources.repo
-rw-r--r--. 1 root root   74 Aug 13  2019 CentOS-Vault.repo

2.#删除所有的.repo源文件----->很重要

[root@localhost yum.repos.d]# rm *.repo #
rm: remove regular file 'CentOS-AppStream.repo'? y
rm: remove regular file 'CentOS-Base.repo'? y
rm: remove regular file 'CentOS-centosplus.repo'? y
rm: remove regular file 'CentOS-CR.repo'? y
rm: remove regular file 'CentOS-Debuginfo.repo'? y
rm: remove regular file 'CentOS-Extras.repo'? y
rm: remove regular file 'CentOS-fasttrack.repo'? y
rm: remove regular file 'CentOS-Media.repo'? y
rm: remove regular file 'CentOS-PowerTools.repo'? y
rm: remove regular file 'CentOS-Sources.repo'? y
rm: remove regular file 'CentOS-Vault.repo'? y

3.#下载可用的.repo文件

[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
--2024-05-20 06:54:40--  https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 113.207.38.79, 58.19.152.234, 121.31.228.216, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|113.207.38.79|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2495 (2.4K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’

/etc/yum.repos.d/Ce 100%[===================>]   2.44K  --.-KB/s    in 0s      

2024-05-20 06:54:40 (39.5 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2495/2495]

4.#运行yum makecache生成缓存

[root@localhost yum.repos.d]# yum makecache
CentOS-8.5.2111 - AppStream - mirrors.aliyun.co 3.5 MB/s | 8.4 MB     00:02    
CentOS-8.5.2111 - Base - mirrors.aliyun.com      13 kB/s | 3.9 kB     00:00    
CentOS-8.5.2111 - Extras - mirrors.aliyun.com   2.9 kB/s | 1.5 kB     00:00    
Metadata cache created.

5.#运行yum install -y yum-utils

[root@localhost yum.repos.d]# yum install -y yum-utils

完成!!

②错误步骤:(请勿模仿)

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ll

total 44
-rw-r--r--. 1 root root  731 Aug 13  2019 CentOS-AppStream.repo
-rw-r--r--. 1 root root  712 Aug 13  2019 CentOS-Base.repo
-rw-r--r--. 1 root root  798 Aug 13  2019 CentOS-centosplus.repo
-rw-r--r--. 1 root root 1320 Aug 13  2019 CentOS-CR.repo
-rw-r--r--. 1 root root  668 Aug 13  2019 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  756 Aug 13  2019 CentOS-Extras.repo
-rw-r--r--. 1 root root  338 Aug 13  2019 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  928 Aug 13  2019 CentOS-Media.repo
-rw-r--r--. 1 root root  736 Aug 13  2019 CentOS-PowerTools.repo
-rw-r--r--. 1 root root 1382 Aug 13  2019 CentOS-Sources.repo
-rw-r--r--. 1 root root   74 Aug 13  2019 CentOS-Vault.repo

[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
--2024-05-20 06:39:37--  https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 113.207.38.116, 113.207.38.79, 113.207.38.80, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|113.207.38.116|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2495 (2.4K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’

/etc/yum.repos.d/Ce 100%[===================>]   2.44K  --.-KB/s    in 0s      

2024-05-20 06:39:38 (66.7 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2495/2495]

[root@localhost yum.repos.d]# yum makecache
Repository AppStream is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
CentOS-8 - AppStream                             25  B/s |  38  B     00:01    
CentOS-8.5.2111 - Base - mirrors.aliyun.com     1.7 MB/s | 4.6 MB     00:02    
CentOS-8.5.2111 - Extras - mirrors.aliyun.com   4.3 kB/s |  10 kB     00:02    
Failed to synchronize cache for repo 'AppStream', ignoring this repo.
Metadata cache created.

[root@localhost yum.repos.d]# yum install -y yum-utils
Repository AppStream is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
CentOS-8 - AppStream                             24  B/s |  38  B     00:01    
CentOS-8.5.2111 - Base - mirrors.aliyun.com     3.2 kB/s | 3.9 kB     00:01    
CentOS-8.5.2111 - Extras - mirrors.aliyun.com   1.3 kB/s | 1.5 kB     00:01    
Failed to synchronize cache for repo 'AppStream', ignoring this repo.
Error: 
 Problem: package python3-libdnf-0.63.0-3.el8.x86_64 requires libsolv.so.1()(64bit), but none of the providers can be installed
  - package python3-libdnf-0.63.0-3.el8.x86_64 requires libsolvext.so.1()(64bit), but none of the providers can be installed
  - package python3-dnf-4.7.0-4.el8.noarch requires python3-libdnf >= 0.61.1, but none of the providers can be installed
  - cannot install both libsolv-0.7.19-1.el8.x86_64 and libsolv-0.6.35-6.el8.x86_64
  - package yum-utils-4.0.21-3.el8.noarch requires python3-dnf >= 4.2.22, but none of the providers can be installed
  - package rpm-ostree-libs-2018.8-2.el8.0.1.x86_64 requires libsolv.so.0()(64bit), but none of the providers can be installed
  - package rpm-ostree-libs-2018.8-2.el8.0.1.x86_64 requires libsolv.so.0(SOLV_1.0)(64bit), but none of the providers can be installed
  - conflicting requests
  - problem with installed package rpm-ostree-libs-2018.8-2.el8.0.1.x86_64
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
 

#运行yum install -y yum-utils又报错--->原因:没有删除所有的.repo源文件

二、成功在CentOS系统上添加Docker的官方仓库

三、启动 docker

[root@localhost ~]# systemctl start docker

查看版本:

[root@localhost ~]# docker version

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

闽ICP备14008679号