Ubuntu报错E: Failed to fetch http://mirrors.cloud.aliyuncs.com解决方案

文章讲述了用户在更新源和下载工具包时遇到阿里云镜像链接无法解析的问题,经过尝试更换DNS和国内镜像源后,发现是DNS解析设置问题。作者提供了修改`/etc/resolv.conf`文件,将DNS服务器从127.0.0.253改为阿里云默认的127.0.0.53来解决此问题的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

报错内容:

在进行更新源和下载工具包时都会报错类似以下内容:
Could not resolve ‘mirrors.cloud.aliyuncs.com’
E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu-ports/pool/main/n/nginx/nginx-common_1.18.0-6ubuntu14.4_all.deb Could not resolve ‘mirrors.cloud.aliyuncs.com’
E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu-ports/pool/main/n/nginx/libnginx-mod-http-geoip2_1.18.0-6ubuntu14.4_arm64.deb Could not resolve ‘mirrors.cloud.aliyuncs.com’
E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu-ports/pool/main/n/nginx/libnginx-mod-http-image-filter_1.18.0-6ubuntu14.4_arm64.deb Could not resolve ‘mirrors.cloud.aliyuncs.com’
E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu-ports/pool/main/n/nginx/libnginx-mod-http-xslt-filter_1.18.0-6ubuntu14.4_arm64.deb Could not resolve ‘mirrors.cloud.aliyuncs.com’
E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu-ports/pool/main/n/nginx/libnginx-mod-mail_1.18.0-6ubuntu14.4_arm64.deb Could not resolve ‘mirrors.cloud.aliyuncs.com’
E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu-ports/pool/main/n/nginx/libnginx-mod-stream_1.18.0-6ubuntu14.4_arm64.deb Could not resolve ‘mirrors.cloud.aliyuncs.com’
E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu-ports/pool/main/n/nginx/libnginx-mod-stream-geoip2_1.18.0-6ubuntu14.4_arm64.deb Could not resolve ‘mirrors.cloud.aliyuncs.com’
E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu-ports/pool/main/n/nginx/nginx-core_1.18.0-6ubuntu14.4_arm64.deb Could not resolve ‘mirrors.cloud.aliyuncs.com’
E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu-ports/pool/main/n/nginx/nginx_1.18.0-6ubuntu14.4_arm64.deb Could not resolve ‘mirrors.cloud.aliyuncs.com’
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

寻求方法:

报错提示无法解析阿里云镜像链接,在网上找了很多解决方案,主要指出两个问题:
1.DNS解析问题
添加了以下DNS依然存在问题
在这里插入图片描述

2.镜像源问题
修改成国内镜像源依然没有解决

最终解决

发现我的问题是DNS解析问题
阿里云的DNS是127.0.0.53,我添加的是127.0.0.253
修改后解决

1.打开并修改配置文件

sudo vi /etc/resolv.conf

2.在文件中添加阿里云DNS(按i进入编辑模式,添加后esc退出编辑模式,输入:wq保存并退出)

nameserver 127.0.0.53

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值