1、错误信息:
[root@localhost atguigu]# yum install docker
已加载插件:fastestmirror, langpacks
Repository base is listed more than once in the configuration
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"One of the configured repositories failed (未知),and yum doesn't have enough cached data to continue. At this point the onlysafe thing yum can do is fail. There are a few ways to work "fix" this:1. Contact the upstream for the repository and get them to fix the problem.2. Reconfigure the baseurl/etc. for the repository, to point to a workingupstream. This is most often useful if you are using a newerdistribution release than is supported by the repository (and thepackages for the previous distribution release still work).3. Run the command with the repository temporarily disabledyum --disablerepo=<repoid> ...4. Disable the repository permanently, so yum won't use it by default. Yumwill then just ignore the repository until you permanently enable itagain or use --enablerepo for temporary usage:yum-config-manager --disable <repoid>orsubscription-manager repos --disable=<repoid>5. Configure the failing repository to be skipped, if it is unavailable.Note that yum will try to contact the repo. when it runs most commands,so will have to try and fail each time (and thus. yum will be be muchslower). If it is a very temporary problem though, this is often a nicecompromise:yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=trueCannot find a valid baseurl for repo: base/7/x86_64
2、处理办法:
1. 解决 DNS 解析问题
无法解析 mirrorlist.centos.org
可能是 DNS 配置有误或者网络连接存在问题。你可以按照下面的步骤来解决:
检查网络连接
使用 ping
命令测试网络连通性:
bash
ping www.baidu.com
如果无法 ping
通,需要检查网络配置、防火墙设置或者联系网络管理员。
检查 DNS 配置
查看 /etc/resolv.conf
文件,确认其中的 DNS 服务器配置是否正确。你可以使用以下命令查看文件内容:
bash
cat /etc/resolv.conf
若 DNS 配置有误,可以使用公共的 DNS 服务器,例如 Google 的 8.8.8.8
和 8.8.4.4
,或者阿里云的 223.5.5.5
和 223.6.6.6
。编辑 /etc/resolv.conf
文件,添加或者修改 DNS 服务器配置:
bash
nameserver 8.8.8.8
nameserver 8.8.4.4
或者
bash
nameserver 223.5.5.5
nameserver 223.6.6.6
2. 解决 base
仓库 baseurl
问题
可以通过替换为国内镜像源来解决这个问题,下面以阿里云镜像源为例:
备份原有的 CentOS-Base.repo
文件
bash
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
下载阿里云的 CentOS-Base.repo
文件
bash
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
清除 yum 缓存并重新生成
bash
yum clean all
yum makecache
3. 解决仓库重复配置问题
错误信息中提到 Repository base is listed more than once in the configuration
,这表明 base
仓库在配置文件中被重复列出了。你可以检查 /etc/yum.repos.d
目录下的所有 .repo
文件,确保 base
仓库只被配置了一次。
4. 再次尝试安装 Docker
完成上述操作之后,再次尝试安装 Docker:
bash
yum install docker
3、安装成功信息:
[root@localhost atguigu]# yum install docker
已加载插件:fastestmirror, langpacks
Repository base is listed more than once in the configuration
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 docker.x86_64.2.1.13.1-210.git7d71120.el7.centos 将被 安装
--> 正在处理依赖关系 docker-common = 2:1.13.1-210.git7d71120.el7.centos,它被软件包 2:docker-1.13.1-210.git7d71120.el7.centos.x86_64 需要
--> 正在处理依赖关系 docker-client = 2:1.13.1-210.git7d71120.el7.centos,它被软件包 2:docker-1.13.1-210.git7d71120.el7.centos.x86_64 需要
--> 正在处理依赖关系 subscription-manager-rhsm-certificates,它被软件包 2:docker-1.13.1-210.git7d71120.el7.centos.x86_64 需要
--> 正在检查事务
---> 软件包 docker-client.x86_64.2.1.13.1-210.git7d71120.el7.centos 将被 安装
---> 软件包 docker-common.x86_64.2.1.13.1-210.git7d71120.el7.centos 将被 安装
--> 正在处理依赖关系 skopeo-containers >= 1:0.1.26-2,它被软件包 2:docker-common-1.13.1-210.git7d71120.el7.centos.x86_64 需要
--> 正在处理依赖关系 oci-umount >= 2:2.3.3-3,它被软件包 2:docker-common-1.13.1-210.git7d71120.el7.centos.x86_64 需要
--> 正在处理依赖关系 oci-systemd-hook >= 1:0.1.4-9,它被软件包 2:docker-common-1.13.1-210.git7d71120.el7.centos.x86_64 需要
--> 正在处理依赖关系 oci-register-machine >= 1:0-5.13,它被软件包 2:docker-common-1.13.1-210.git7d71120.el7.centos.x86_64 需要
--> 正在处理依赖关系 container-storage-setup >= 0.9.0-1,它被软件包 2:docker-common-1.13.1-210.git7d71120.el7.centos.x86_64 需要
--> 正在处理依赖关系 container-selinux >= 2:2.51-1,它被软件包 2:docker-common-1.13.1-210.git7d71120.el7.centos.x86_64 需要
--> 正在处理依赖关系 atomic-registries,它被软件包 2:docker-common-1.13.1-210.git7d71120.el7.centos.x86_64 需要
---> 软件包 subscription-manager-rhsm-certificates.x86_64.0.1.24.54-1.el7.centos 将被 安装
--> 正在检查事务
---> 软件包 atomic-registries.x86_64.1.1.22.1-33.gitb507039.el7_8 将被 安装
--> 正在处理依赖关系 python-pytoml,它被软件包 1:atomic-registries-1.22.1-33.gitb507039.el7_8.x86_64 需要
---> 软件包 container-selinux.noarch.2.2.119.2-1.911c772.el7_8 将被 安装
---> 软件包 container-storage-setup.noarch.0.0.11.0-2.git5eaf76c.el7 将被 安装
---> 软件包 containers-common.x86_64.1.0.1.40-11.el7_8 将被 安装
--> 正在处理依赖关系 subscription-manager,它被软件包 1:containers-common-0.1.40-11.el7_8.x86_64 需要
--> 正在处理依赖关系 slirp4netns,它被软件包 1:containers-common-0.1.40-11.el7_8.x86_64 需要
--> 正在处理依赖关系 fuse-overlayfs,它被软件包 1:containers-common-0.1.40-11.el7_8.x86_64 需要
---> 软件包 oci-register-machine.x86_64.1.0-6.git2b44233.el7 将被 安装
---> 软件包 oci-systemd-hook.x86_64.1.0.2.0-1.git05e6923.el7_6 将被 安装
---> 软件包 oci-umount.x86_64.2.2.5-3.el7 将被 安装
--> 正在检查事务
---> 软件包 fuse-overlayfs.x86_64.0.0.7.2-6.el7_8 将被 安装
--> 正在处理依赖关系 libfuse3.so.3(FUSE_3.2)(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
--> 正在处理依赖关系 libfuse3.so.3(FUSE_3.0)(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
--> 正在处理依赖关系 libfuse3.so.3()(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
---> 软件包 python-pytoml.noarch.0.0.1.14-1.git7dea353.el7 将被 安装
---> 软件包 slirp4netns.x86_64.0.0.4.3-4.el7_8 将被 安装
---> 软件包 subscription-manager.x86_64.0.1.24.54-1.el7.centos 将被 安装
--> 正在处理依赖关系 subscription-manager-rhsm = 1.24.54,它被软件包 subscription-manager-1.24.54-1.el7.centos.x86_64 需要
--> 正在处理依赖关系 python-dmidecode >= 3.12.2-2,它被软件包 subscription-manager-1.24.54-1.el7.centos.x86_64 需要
--> 正在处理依赖关系 python-syspurpose,它被软件包 subscription-manager-1.24.54-1.el7.centos.x86_64 需要
--> 正在检查事务
---> 软件包 fuse3-libs.x86_64.0.3.6.1-4.el7 将被 安装
---> 软件包 python-dmidecode.x86_64.0.3.12.2-4.el7 将被 安装
---> 软件包 python-syspurpose.x86_64.0.1.24.54-1.el7.centos 将被 安装
---> 软件包 subscription-manager-rhsm.x86_64.0.1.24.54-1.el7.centos 将被 安装
--> 解决依赖关系完成依赖关系解决=======================================================================================Package 架构 版本 源 大小
=======================================================================================
正在安装:docker x86_64 2:1.13.1-210.git7d71120.el7.centos extras 17 M
为依赖而安装:atomic-registries x86_64 1:1.22.1-33.gitb507039.el7_8 extras 36 kcontainer-selinux noarch 2:2.119.2-1.911c772.el7_8 extras 40 kcontainer-storage-setup noarch 0.11.0-2.git5eaf76c.el7 extras 35 kcontainers-common x86_64 1:0.1.40-11.el7_8 extras 43 kdocker-client x86_64 2:1.13.1-210.git7d71120.el7.centos extras 3.9 Mdocker-common x86_64 2:1.13.1-210.git7d71120.el7.centos extras 101 kfuse-overlayfs x86_64 0.7.2-6.el7_8 extras 54 kfuse3-libs x86_64 3.6.1-4.el7 extras 82 koci-register-machine x86_64 1:0-6.git2b44233.el7 extras 1.1 Moci-systemd-hook x86_64 1:0.2.0-1.git05e6923.el7_6 extras 34 koci-umount x86_64 2:2.5-3.el7 extras 33 kpython-dmidecode x86_64 3.12.2-4.el7 base 83 kpython-pytoml noarch 0.1.14-1.git7dea353.el7 extras 18 kpython-syspurpose x86_64 1.24.54-1.el7.centos updates 277 kslirp4netns x86_64 0.4.3-4.el7_8 extras 81 ksubscription-manager x86_64 1.24.54-1.el7.centos updates 1.1 Msubscription-manager-rhsm x86_64 1.24.54-1.el7.centos updates 336 ksubscription-manager-rhsm-certificatesx86_64 1.24.54-1.el7.centos updates 240 k事务概要
=======================================================================================
安装 1 软件包 (+18 依赖软件包)总下载量:25 M
安装大小:86 M
Is this ok [y/d/N]: y
Downloading packages:
警告:/var/cache/yum/x86_64/7/extras/packages/atomic-registries-1.22.1-33.gitb507039.el7_8.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
atomic-registries-1.22.1-33.gitb507039.el7_8.x86_64.rpm 的公钥尚未安装
(1/19): atomic-registries-1.22.1-33.gitb507039.el7_8.x86_64.rpm | 36 kB 00:00:00
(2/19): container-storage-setup-0.11.0-2.git5eaf76c.el7.noarch. | 35 kB 00:00:00
(3/19): container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm | 40 kB 00:00:00
(4/19): containers-common-0.1.40-11.el7_8.x86_64.rpm | 43 kB 00:00:00
(5/19): docker-1.13.1-210.git7d71120.el7.centos.x86_64.rpm | 17 MB 00:00:00
(6/19): docker-common-1.13.1-210.git7d71120.el7.centos.x86_64.r | 101 kB 00:00:00
(7/19): docker-client-1.13.1-210.git7d71120.el7.centos.x86_64.r | 3.9 MB 00:00:00
(8/19): fuse3-libs-3.6.1-4.el7.x86_64.rpm | 82 kB 00:00:00
(9/19): fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm | 54 kB 00:00:00
(10/19): oci-systemd-hook-0.2.0-1.git05e6923.el7_6.x86_64.rpm | 34 kB 00:00:00
(11/19): oci-umount-2.5-3.el7.x86_64.rpm | 33 kB 00:00:00
(12/19): python-pytoml-0.1.14-1.git7dea353.el7.noarch.rpm | 18 kB 00:00:00
python-dmidecode-3.12.2-4.el7.x86_64.rpm 的公钥尚未安装
(13/19): python-dmidecode-3.12.2-4.el7.x86_64.rpm | 83 kB 00:00:00
(14/19): slirp4netns-0.4.3-4.el7_8.x86_64.rpm | 81 kB 00:00:00
python-syspurpose-1.24.54-1.el7.centos.x86_64.rpm 的公钥尚未安装
(15/19): python-syspurpose-1.24.54-1.el7.centos.x86_64.rpm | 277 kB 00:00:00
(16/19): subscription-manager-1.24.54-1.el7.centos.x86_64.rpm | 1.1 MB 00:00:00
(17/19): subscription-manager-rhsm-certificates-1.24.54-1.el7.c | 240 kB 00:00:00
(18/19): subscription-manager-rhsm-1.24.54-1.el7.centos.x86_64. | 336 kB 00:00:00
(19/19): oci-register-machine-0-6.git2b44233.el7.x86_64.rpm | 1.1 MB 00:00:01
---------------------------------------------------------------------------------------
总计 8.4 MB/s | 25 MB 00:02
从 http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 检索密钥
导入 GPG key 0xF4A80EB5:用户ID : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"指纹 : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5来自 : http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
是否继续?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction正在安装 : subscription-manager-rhsm-certificates-1.24.54-1.el7.centos.x8 1/19 正在安装 : subscription-manager-rhsm-1.24.54-1.el7.centos.x86_64 2/19 正在安装 : python-dmidecode-3.12.2-4.el7.x86_64 3/19 正在安装 : python-pytoml-0.1.14-1.git7dea353.el7.noarch 4/19 正在安装 : 1:atomic-registries-1.22.1-33.gitb507039.el7_8.x86_64 5/19 正在安装 : slirp4netns-0.4.3-4.el7_8.x86_64 6/19 正在安装 : container-storage-setup-0.11.0-2.git5eaf76c.el7.noarch 7/19 正在安装 : 2:oci-umount-2.5-3.el7.x86_64 8/19 正在安装 : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 9/19 正在安装 : 1:oci-register-machine-0-6.git2b44233.el7.x86_64 10/19 正在安装 : 1:oci-systemd-hook-0.2.0-1.git05e6923.el7_6.x86_64 11/19 正在安装 : python-syspurpose-1.24.54-1.el7.centos.x86_64 12/19 正在安装 : subscription-manager-1.24.54-1.el7.centos.x86_64 13/19 正在安装 : fuse3-libs-3.6.1-4.el7.x86_64 14/19 正在安装 : fuse-overlayfs-0.7.2-6.el7_8.x86_64 15/19 正在安装 : 1:containers-common-0.1.40-11.el7_8.x86_64 16/19 正在安装 : 2:docker-common-1.13.1-210.git7d71120.el7.centos.x86_64 17/19 正在安装 : 2:docker-client-1.13.1-210.git7d71120.el7.centos.x86_64 18/19 正在安装 : 2:docker-1.13.1-210.git7d71120.el7.centos.x86_64 19/19 验证中 : 2:docker-client-1.13.1-210.git7d71120.el7.centos.x86_64 1/19 验证中 : fuse3-libs-3.6.1-4.el7.x86_64 2/19 验证中 : python-syspurpose-1.24.54-1.el7.centos.x86_64 3/19 验证中 : 1:atomic-registries-1.22.1-33.gitb507039.el7_8.x86_64 4/19 验证中 : 1:oci-systemd-hook-0.2.0-1.git05e6923.el7_6.x86_64 5/19 验证中 : fuse-overlayfs-0.7.2-6.el7_8.x86_64 6/19 验证中 : 2:docker-common-1.13.1-210.git7d71120.el7.centos.x86_64 7/19 验证中 : 2:docker-1.13.1-210.git7d71120.el7.centos.x86_64 8/19 验证中 : 1:oci-register-machine-0-6.git2b44233.el7.x86_64 9/19 验证中 : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 10/19 验证中 : 2:oci-umount-2.5-3.el7.x86_64 11/19 验证中 : container-storage-setup-0.11.0-2.git5eaf76c.el7.noarch 12/19 验证中 : slirp4netns-0.4.3-4.el7_8.x86_64 13/19 验证中 : subscription-manager-rhsm-1.24.54-1.el7.centos.x86_64 14/19 验证中 : python-pytoml-0.1.14-1.git7dea353.el7.noarch 15/19 验证中 : subscription-manager-rhsm-certificates-1.24.54-1.el7.centos.x8 16/19 验证中 : 1:containers-common-0.1.40-11.el7_8.x86_64 17/19 验证中 : python-dmidecode-3.12.2-4.el7.x86_64 18/19 验证中 : subscription-manager-1.24.54-1.el7.centos.x86_64 19/19 已安装:docker.x86_64 2:1.13.1-210.git7d71120.el7.centos 作为依赖被安装:atomic-registries.x86_64 1:1.22.1-33.gitb507039.el7_8 container-selinux.noarch 2:2.119.2-1.911c772.el7_8 container-storage-setup.noarch 0:0.11.0-2.git5eaf76c.el7 containers-common.x86_64 1:0.1.40-11.el7_8 docker-client.x86_64 2:1.13.1-210.git7d71120.el7.centos docker-common.x86_64 2:1.13.1-210.git7d71120.el7.centos fuse-overlayfs.x86_64 0:0.7.2-6.el7_8 fuse3-libs.x86_64 0:3.6.1-4.el7 oci-register-machine.x86_64 1:0-6.git2b44233.el7 oci-systemd-hook.x86_64 1:0.2.0-1.git05e6923.el7_6 oci-umount.x86_64 2:2.5-3.el7 python-dmidecode.x86_64 0:3.12.2-4.el7 python-pytoml.noarch 0:0.1.14-1.git7dea353.el7 python-syspurpose.x86_64 0:1.24.54-1.el7.centos slirp4netns.x86_64 0:0.4.3-4.el7_8 subscription-manager.x86_64 0:1.24.54-1.el7.centos subscription-manager-rhsm.x86_64 0:1.24.54-1.el7.centos subscription-manager-rhsm-certificates.x86_64 0:1.24.54-1.el7.centos 完毕!