使用 sudo apt-get update 或安装包时出现错误。
Err http://ca.archive.ubuntu.com precise InRelease
Err http://security.ubuntu.com precise-security InRelease
Err http://ca.archive.ubuntu.com precise-updates InRelease
Err http://ca.archive.ubuntu.com precise-backports InRelease
Err http://security.ubuntu.com precise-security Release.gpg
Temporary failure resolving 'security.ubuntu.com'
Err http://ca.archive.ubuntu.com precise Release.gpg
Temporary failure resolving 'ca.archive.ubuntu.com'
Err http://ca.archive.ubuntu.com precise-updates Release.gpg
Temporary failure resolving 'ca.archive.ubuntu.com'
Err http://ca.archive.ubuntu.com precise-backports Release.gpg
Temporary failure resolving 'ca.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://ca.archive.ubuntu.com/ubuntu/dists/precise/InRelease
W: Failed to fetch http://ca.archive.ubuntu.com/ubuntu/dists/precise-updates/InRelease
W: Failed to fetch http://ca.archive.ubuntu.com/ubuntu/dists/precise-backports/InRelease
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/InRelease
W: Failed to fetch http://ca.archive.ubuntu.com/ubuntu/dists/precise/Release.gpg Temporary failure resolving 'ca.archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/Release.gpg Temporary failure resolving 'security.ubuntu.com'
W: Failed to fetch http://ca.archive.ubuntu.com/ubuntu/dists/precise-updates/Release.gpg Temporary failure resolving 'ca.archive.ubuntu.com'
W: Failed to fetch http://ca.archive.ubuntu.com/ubuntu/dists/precise-backports/Release.gpg Temporary failure resolving 'ca.archive.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
答案1
将 IP 地址更改为静态后,我遇到了此错误。执行此操作时,我没有在写入中输入 ip,导致服务器无法访问互联网。