ubuntu系统中执行sudo apt-get update报错如下:
Err:1 http://security.ubuntu.com/ubuntu disco-security InRelease
Temporary failure resolving 'security.ubuntu.com'
Err:2 http://cn.archive.ubuntu.com/ubuntu disco InRelease
Temporary failure resolving 'cn.archive.ubuntu.com'
Err:3 http://cn.archive.ubuntu.com/ubuntu disco-updates InRelease
Temporary failure resolving 'cn.archive.ubuntu.com'
Err:4 http://cn.archive.ubuntu.com/ubuntu disco-backports InRelease
Temporary failure resolving 'cn.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/disco/InRelease Temporary failure resolving 'cn.archive.ubuntu.com'
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/disco-updates/InRelease Temporary failure resolving 'cn.archive.ubuntu.com'
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/disco-backports/InRelease Temporary failure resolving 'cn.archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/disco-security/InRelease Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
问题在于DNS没有配置好,执行命令
sudo vi /etc/resolv.conf
#新添加begin
nameserver 8.8.8.8
nameserver 8.8.4.4
#新添加end
nameserver 127.0.0.53
options edns0
Esc取消编辑模式,:wq!保存编辑退出,执行cat命令查看是否编辑成功
sudo cat /etc/resolv.conf
之后执行sudo apt-get update就正常了。
网友评论