Centos yum报错‘Connection timed out after 30002 milliseconds‘) 正在尝试其它镜像。解决办法

修改源后更新报错

我有两个Centos 一个7 一个8,疏忽在7上面配置了8的源后报错,通过下面的报错发现提示的是Centos7的源找不到,才意识到是不是配置错了源。

报错信息:

bash 复制代码
http://mirrors.aliyun.com/centos/7/AppStream/x86_64/os/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
正在尝试其它镜像。
To address this issue please refer to the below wiki article 

https://wiki.centos.org/yum-errors

If above article doesn't help to resolve this issue please use https://bugs.centos.org/.

http://mirrors.cloud.aliyuncs.com/centos/7/AppStream/x86_64/os/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; 未知的错误"
正在尝试其它镜像。
http://mirrors.aliyuncs.com/centos/7/AppStream/x86_64/os/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7/AppStream/x86_64/os/repodata/repomd.xml: (28, 'Connection timed out after 30002 milliseconds')
正在尝试其它镜像。

查看Centos的版本

bash 复制代码
cat /etc/centos-release

可以看到自己使用的是7

备份源文件

bash 复制代码
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak

下载7的源文件

bash 复制代码
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

如果没有安装wget 不能下载,需要在浏览器中下载源文件上传到/etc/yum.repos.d/目录下

如果你的是8的把命令Centos-7.repo改为Centos-8.repo即可。

加载缓存

bash 复制代码
yum makecache

再次运行更新命令即可恢复

相关推荐
搞Linux的杰仔20 分钟前
Ubuntu20.04基础配置安装——系统安装(一)
linux·嵌入式开发
Kaede63 小时前
如何应对Linux云服务器磁盘空间不足的情况
linux·运维·服务器
Kookoos6 小时前
Dynamics 365 Finance + Power Automate 自动化凭证审核
运维·自动化·dynamics 365·power automate
apocelipes8 小时前
Linux c 运行时获取动态库所在路径
linux·c语言·linux编程
努力学习的小廉9 小时前
深入了解linux系统—— 进程池
linux·运维·服务器
秃头菜狗9 小时前
各个主要目录的功能 / Linux 常见指令
linux·运维·服务器
2301_793102499 小时前
Linux——MySql数据库
linux·数据库
jiunian_cn11 小时前
【Linux】centos软件安装
linux·运维·centos
睡觉待开机11 小时前
0. MySQL在Centos 7环境安装
数据库·mysql·centos
藥瓿亭11 小时前
K8S认证|CKS题库+答案| 6. 创建 Secret
运维·ubuntu·docker·云原生·容器·kubernetes·cks