sudo apt-get update会失败,修改主机的dns的地址和更换源
ping google.com 不同
看本机的DNS配置信息是在:/etc/resolv.conf
发现是保留ip
修改直接vim /etc/resolv.conf
写入:
nameserver 8.8.8.8
保存之后重启一下网络服务
sudo /etc/init.d/networking restart
接下来就是修改apt的源
vim /etc/apt/sources.list
将里面的内容替换为下面的:
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
保存
然后去执行
sudo apt-get update