Ubuntu20.04换阿里源、清华源和增加域名服务器
每次创建一个全新的Ubuntu第一步,我都是换源然后增加域名服务器,可以大幅度缓解下载缓慢或者下载失败的问题。
换源
1.打开sources.list
sudo nano /etc/apt/sources.list
2.加入阿里源和清华源到最上头
deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
结果如下:
然后ctrl+o保存,Enter确认,最后ctrl+x退出
3.之后更新软件包列表
sudo apt update
增加谷歌域名服务器
1.打开resolv.conf文件:
sudo nano /etc/resolv.conf
2.在原域名服务器的上面再增加两个
nameserver 8.8.8.8 #google域名服务器
nameserver 8.8.4.4 #google域名服务器
之后ctrl+o保存,Enter确认,最后ctrl+x退出即可。