Ubuntu apt-get update 失败

1 $ sudo  apt-get update

报了一堆错误:

Err http://cn.archive.ubuntu.com trusty InRelease

Err http://cn.archive.ubuntu.com trusty-updates InRelease

Err http://cn.archive.ubuntu.com trusty-backports InRelease

Err http://cn.archive.ubuntu.com trusty Release.gpg     

W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/trusty/InRelease

解决方案: 修改DNS

sudo vi  /etc/resolvconf/resolv.conf.d/base

在里面插入:

nameserver 8.8.8.8
nameserver 8.8.4.4

修改好保存!wq,
然后执行

$ sudo resolvconf -u

再看 /etc/resolv.conf,最下面就多了2行:


$ cat /etc/resolv.conf

显示


# 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 8.8.8.8

nameserver 8.8.4.4

此时执行

$ sudo  apt-get update

可以运行,然后就可以使用sudo apt-get install **指令了。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容