ubuntu 14.04 apt-get update 域名无法解析

时间:2024-03-02 21:27:02

借鉴网址:

https://blog.csdn.net/q290994/article/details/80577711

https://blog.csdn.net/qq_24326765/article/details/81953579
 

1、备份

cp /etc/apt/sources.list /etc/apt/sources.list.bak

2、修改

gedit /etc/apt/sources.list

3、更改源

我用的是更换为中科大源

将如下代码粘贴

deb http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse

4、生效:

sudo apt-get update

5、 好像不行,

修改dns:

sudo gedit /etc/resolvconf/resolv.conf.d/base(这个文件默认是空的)

在里面插入:
nameserver 8.8.8.8

如果有多个DNS就一行一个

修改好保存,然后使其生效

sudo resolvconf -u

 

 

测试:sudo apt-get update 可行