A哥

Ubuntu 使用apt-get安装报错Could not resolve

作者:A哥 发布时间: 2020-09-2      1.94K 人阅读    本文共计1902个字,预计阅读时长7分钟。

报错信息如下

root@k8s-1:/etc/apt/apt.conf.d# apt-get update
Err:1 http://mirrors.aliyun.com/ubuntu bionic InRelease
  Could not resolve 'mirrors.tuna.tsinghua.cn'
Err:2 http://mirrors.aliyun.com/ubuntu bionic-security InRelease
  Could not resolve 'mirrors.tuna.tsinghua.cn'
Err:3 http://mirrors.aliyun.com/ubuntu bionic-updates InRelease
  Could not resolve 'mirrors.tuna.tsinghua.cn'
Err:4 http://mirrors.aliyun.com/ubuntu bionic-proposed InRelease
  Could not resolve 'mirrors.tuna.tsinghua.cn'
Err:5 http://mirrors.aliyun.com/ubuntu bionic-backports InRelease
  Could not resolve 'mirrors.tuna.tsinghua.cn'
Reading package lists... Done
W: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/bionic/InRelease  Could not resolve 'mirrors.tuna.tsinghua.cn'
W: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/bionic-security/InRelease  Could not resolve 'mirrors.tuna.tsinghua.cn'
W: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/bionic-updates/InRelease  Could not resolve 'mirrors.tuna.tsinghua.cn'
W: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/bionic-proposed/InRelease  Could not resolve 'mirrors.tuna.tsinghua.cn'
W: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/bionic-backports/InRelease  Could not resolve 'mirrors.tuna.tsinghua.cn'
W: Some index files failed to download. They have been ignored, or old ones used instead.

这里总结比较常见的几种方法
1.报错大意为不能解析到某个地址
可能的情况有地址不可用,也就是你源配置有误,百度镜像源找阿里,清华,网易等源来配置
2.源正确仍然无法解析?
dns配置有误
配置dns

vim /etc/systemd/resolved.conf

[Resolve]
DNS=8.8.8.8
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=yes

检查自己的dns配置
3.前面2个都没问题。还不能apt
检查是否设置了apt代理,我就是设置了代理,而代理不能用,导致无法使用,那么你需要把代理地址改成有效地址,我是直接取消代理,
代理地址配置文件:

root@k8s-1:/etc/apt/apt.conf.d# pwd
/etc/apt/apt.conf.d
root@k8s-1:/etc/apt/apt.conf.d# vim 90curtin-aptproxy

Acquire::http::Proxy "https://mtsinghua.cn/ubuntu";
Acquire::https::Proxy "https://a.tsinghua.cn/ubuntu";

改成有效地址或直接删除、再apt-get update

file

本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!一切解释权归本站资源所有!转载请注明出处!如有链接无法下载、失效或广告,请联系管理员处理!本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!如用于商业或者非法用途,与本站无关,一切后果请用户自负!如遇到加密压缩包,默认解压密码为"www.pythondesign.cn",如遇到无法解压的请联系管理员!
Linux技术高效运维 » Ubuntu 使用apt-get安装报错Could not resolve

常见问题FAQ

资源有效期多久?
凡是在本站购买下载的资源均可永久使用,无需再次购买,请用户放心下载使用。
没有下载到资源?
若成功购买未能下载获取资源,请右边点击客服联系在线客服处理!也可添加站长微信免费获取资源:pythondesign_cn
在哪里能够获得该资源?
点击本站资源页面,手机端资源页下方有"购买","下载"的字样,PC端右侧栏有"购买","下载"的字样,等点击即可获得!也可以点击QQ咨询,联系站长获取资源!

提供最优质的资源集合!如果说成功归于天赋和才华,倒不如说因为那持之以恒的专注!

立即查看