ubuntu executes apt-get update and reports Failed to fetch/replace Ali source

Copyright Notice: This article is the original article of the blogger, and follows CC 4.0 BY-SA copyright agreement. Please attach the link of the original text and this statement.

the article links: https://blog.csdn.net/feiniao8651/article/details/60332535

in the ubuntu perform sudo apt to get the update, often an error:
 
Err http://security.ubuntu.com precise-security InRelease
Err, http://security.ubuntu.com precise ws-security the GPG
Temporary failure resolving ‘security.ubuntu.com’
Err http://cn.archive.ubuntu.com precise InRelease
Err http://cn.archive.ubuntu.com precise-updates InRelease
Err http://cn.archive.ubuntu.com precise-backports InRelease
Err, http://cn.archive.ubuntu.com precise the GPG
Temporary failure resolving ‘cn.archive.ubuntu.com’
Err http://cn.archive.ubuntu.com precise – updates the GPG
Temporary failure Resolving the ‘cn.archive.ubuntu.com’
Err http://cn.archive.ubuntu.com precise – backports the GPG
Temporary failure resolving ‘cn.archive.ubuntu.com’
Reading package lists… The Done
W: Failed to fetch HTTP:// http://cn.archive.ubuntu.com/ubuntu/dists/precise/InRelease
W: Failed to fetch HTTP:// http://cn.archive.ubuntu.com/ubuntu/dists/precise-updates/InRelease
W: Failed to fetch HTTP:// http://cn.archive.ubuntu.com/ubuntu/dists/precise-backports/InRelease
W: Failed to fetch HTTP:// http://security.ubuntu.com/ubuntu/dists/precise-security/InRelease
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://cn.archive.ubuntu.com/ubuntu/dists/precise/Release.gpg Temporary failure resolving ‘cn.archive.ubuntu.com’
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-updates/Release.gpg Temporary failure resolving ‘cn.archive.ubuntu.com’
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-backports/Release.gpg Temporary failure resolving ‘cn.archive.ubuntu.com’
W: Some index files failed to download. They have been ignored, or old ones used instead.12345678910111213141516171819202122232425262728293031323334
It is generally recommended to use a domestic mirror source, such as 163 or aliyun’s mirror server
to add the following text to the /etc/apt/ source.list file
 
Deb http://mirrors.aliyun.com/ubuntu/ raring main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ raring ws-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ raring – updates the main restricted universe multiverse
deb raring – http://mirrors.aliyun.com/ubuntu/ programs main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ raring – backports main restricted universe multiverse
deb – SRC http://mirrors.aliyun.com/ubuntu/ raring main restricted universe multiverse
deb – SRC http://mirrors.aliyun.com/ubuntu/ raring ws-security main restricted universe multiverse
deb – SRC http://mirrors.aliyun.com/ubuntu/ raring – updates the main restricted universe multiverse
deb – SRC http://mirrors.aliyun.com/ubuntu/ raring – programs main restricted universe multiverse
deb – SRC http://mirrors.aliyun.com/ubuntu/ raring – backports main restricted universe multiverse, 12345678910
However, executing sudo Apt-get update still gives an error. The problem is that DNS is not properly configured.
solution:
 
sudo vi /etc/resolv.conf1
add
 
Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS file by HAND — YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1

nameserver 223.5.5.5
nameserver 223.6.6.6
Then the SUdo Apt-get Update will work.
Reference:
ubuntu apt-get update failed to resolve.
Ubuntu operating system “Failed to fetch” error solution
docker Ubuntu container to replace the alibaba source
— — —
copyright notice: this article is the original article of CSDN blogger “feiniao8651”, following CC 4.0 by-sa copyright agreement, reprint please attach the original source link and this statement.
the original link: https://blog.csdn.net/feiniao8651/article/details/60332535

Read More: