[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)
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
![[Centos 7.9]yum 源错误配置教程-资源刺客](http://images.kodo.cdn.itdka.cn/wp-content/uploads/2025/12/20251216183334722.jpeg)

![[学习笔记 Day02]Vue基础:前端造梦,继续干!-资源刺客](http://images.kodo.cdn.itdka.cn/wp-content/uploads/2025/09/20250919193418264.jpeg)
![[学习笔记 Day01]C++基础:简单的程序设计,始于梦想的开始!-资源刺客](http://images.kodo.cdn.itdka.cn/wp-content/uploads/2025/09/20250922171813209.webp)


![[服务器环境部署 + 详细教程] Java 环境的配置!-资源刺客](http://images.kodo.cdn.itdka.cn/wp-content/uploads/2025/12/20251215201002140.jpeg)





![[vsFTPD + FileZilla]在CentOS 7.9上部署 FTP 服务,并实现在 Windows 上连接并上传文件!-资源刺客](http://images.kodo.cdn.itdka.cn/wp-content/uploads/2025/12/20251218122830674.webp)
![[Vmware + CentOS 7.9]部署测试环境 Hadoop 服务!-资源刺客](http://images.kodo.cdn.itdka.cn/wp-content/uploads/2025/12/20251216201253477.png)
![[自动化 + 手残党专属]宝塔安装AllinSSL证书管理教程-资源刺客](http://images.kodo.cdn.itdka.cn/wp-content/uploads/2025/11/20251112122722716.png)




暂无评论内容