[root@localhost ~]# yum -y install mysql-community-server 已加载插件: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
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 only safe 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 working upstream. This is most often useful if you are using a newer distribution release than is supported by the repository (and the packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled yum –disablerepo=<repoid> …
4. Disable the repository permanently, so yum won’t use it by default. Yum will then just ignore the repository until you permanently enable it again or use –enablerepo for temporary usage: yum-config-manager –disable <repoid> or subscription-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 much slower). If it is a very temporary problem though, this is often a nice compromise: yum-config-manager –save –setopt=<repoid>.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/7/x86_64
Repository updates is listed more than once in the configuration
Repository extras 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 only safe 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 working upstream. This is most often useful if you are using a newer distribution release than is supported by the repository (and the packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled yum –disablerepo=<repoid> …
4. Disable the repository permanently, so yum won’t use it by default. Yum will then just ignore the repository until you permanently enable it again or use –enablerepo for temporary usage: yum-config-manager –disable <repoid> or subscription-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 much slower). If it is a very temporary problem though, this is often a nice compromise: yum-config-manager –save –setopt=<repoid>.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/7/x86_64
解决方案
使用 mkdir -p /etc/yum.repos.d/backup 命令创建 yum 源备份
![图片[1]-[Centos 7.9]yum 源错误配置教程-资源刺客](https://images.kodo.cdn.itdka.cn/wp-content/uploads/2025/12/20251216181407399-1024x31.png)
使用 mv /etc/yum.repos.d/CentOS-*.repo /etc/yum.repos.d/backup/ 命令进行备份 yum 源的配置文件。
![图片[2]-[Centos 7.9]yum 源错误配置教程-资源刺客](https://images.kodo.cdn.itdka.cn/wp-content/uploads/2025/12/20251216181954383-1024x34.png)
最后使用 curl -o /etc/yum.repos.d/CentOS-Base.repo + 配置源地址 命令进行更改配置源。
![图片[3]-[Centos 7.9]yum 源错误配置教程-资源刺客](https://images.kodo.cdn.itdka.cn/wp-content/uploads/2025/12/20251216182129353-1024x51.png)
配置源地址(排名不分先后)
| yum 源地址名称 | 地址 |
| 阿里云 | https://mirrors.aliyun.com/repo/Centos-7.repo |
| 清华大学 | https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/CentOS-Base.repo |
| 华为云 | https://mirrors.huaweicloud.com/repository/conf/CentOS-7-reg.repo |
| 网易云 | http://mirrors.163.com/.help/CentOS7-Base-163.repo |
| 腾讯云 | https://mirrors.cloud.tencent.com/repo/centos7_base.repo |
| 中科大 | https://mirrors.ustc.edu.cn/centos/7/os/x86_64/CentOS-Base.repo |
最后,使用 yum clean all 和 yun makecache 命令进行清除缓存!
![图片[4]-[Centos 7.9]yum 源错误配置教程-资源刺客](https://images.kodo.cdn.itdka.cn/wp-content/uploads/2025/12/20251216183200932-1024x355.png)
https://wp.itdka.cn/627.html
版权声明
本文版权信息
本文为原创文章,版权归琉璃 | 资源刺客所有,依据 CC BY-NC-SA 4.0 许可协议进行授权。转载请注明出处及本声明,商业使用请联系作者获得授权。
THE END
![[Centos 7.9]yum 源错误配置教程-资源刺客](http://images.kodo.cdn.itdka.cn/wp-content/uploads/2025/12/20251216183334722.jpeg)

![[学习笔记 Day01]C++基础:简单的程序设计,始于梦想的开始!-资源刺客](http://images.kodo.cdn.itdka.cn/wp-content/uploads/2025/09/20250922171813209.webp)
![[学习笔记 Day08]数据分析与应用:数据聚合与分组运算-资源刺客](https://images.kodo.cdn.itdka.cn/wp-content/uploads/2025/09/20250923154612655.png)
![[学习笔记 Day06]Python 数据分析与应用:数据分析库 Pandas 的使用-资源刺客](http://images.kodo.cdn.itdka.cn/wp-content/uploads/2025/09/20250923154612655.png)
![[学习笔记 Day02]Vue基础:前端造梦,继续干!-资源刺客](http://images.kodo.cdn.itdka.cn/wp-content/uploads/2025/09/20250919193418264.jpeg)
![[Windows + Redis]Windows 部署安装 Redis 软件附注册 Windows 服务!-资源刺客](https://images.kodo.cdn.itdka.cn/wp-contents/uploads/2026/05/20260518221407144-科技感ENVI安装教程封面-5.png)

![[玩机教程]某为5G通信壳连接 Cudy TR3000路由器教程-资源刺客](https://images.kodo.cdn.itdka.cn/wp-contents/uploads/2026/03/20260303220540153-openwrt.png)
![[小白详细版]在 Windows 中下载、安装以及配置 Git 版本管理软件!-资源刺客](http://images.kodo.cdn.itdka.cn/wp-content/uploads/2026/02/20260206152542723.png)
![[Windows + OpenClaw]接入飞书,实现便携式通过手机间接操作电脑!-资源刺客](https://images.kodo.cdn.itdka.cn/wp-content/uploads/2026/02/20260214142010155-1024x576.png)
![[服务器环境部署 + 详细教程] Java 环境的配置!-资源刺客](http://images.kodo.cdn.itdka.cn/wp-content/uploads/2025/12/20251215201002140.jpeg)

![[学习笔记 Day03]Redis 基础:Redis 设计的优化建议与最佳实践-资源刺客](https://images.kodo.cdn.itdka.cn/wp-contents/uploads/2026/05/20260521215425110-科技感ENVI安装教程封面-8.png)
![[学习笔记 Day02]Redis + OpenResty + Lua 实现多级缓存-资源刺客](https://images.kodo.cdn.itdka.cn/wp-contents/uploads/2026/05/20260521202850344-科技感ENVI安装教程封面-7.png)
![[学习笔记 Day 01] Redis 基础:从入门到缓存、主从、分片集群的深入-资源刺客](https://images.kodo.cdn.itdka.cn/wp-contents/uploads/2026/05/20260520211903179-科技感ENVI安装教程封面-6.png)

![[自动化 + 手残党专属]宝塔安装AllinSSL证书管理教程-资源刺客](http://images.kodo.cdn.itdka.cn/wp-content/uploads/2025/11/20251112122722716.png)




暂无评论内容