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

清清清子12138 2024-06-27 15:07:03 阅读 78

报错内容:

在进行更新源和下载工具包时都会报错类似以下内容:

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

在这里插入图片描述



声明

本文内容仅代表作者观点,或转载于其他网站,本站不以此文作为商业用途
如有涉及侵权,请联系本站进行删除
转载本站原创文章,请注明来源及作者。