备份Ubuntu默认的源地址
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
chen@ubuntu:~/Desktop$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
chen@ubuntu:~/Desktop$ cd /etc/apt
chen@ubuntu:/etc/apt$ ll
total 52
drwxr-xr-x 7 root root 4096 Oct 12 02:40 ./
drwxr-xr-x 130 root root 12288 Apr 14 07:29 ../
drwxr-xr-x 2 root root 4096 Mar 12 2021 apt.conf.d/
drwxr-xr-x 2 root root 4096 Apr 9 2020 auth.conf.d/
drwxr-xr-x 2 root root 4096 Apr 9 2020 preferences.d/
-rw-r--r-- 1 root root 3162 Mar 12 2021 sources.bak
-rw-rw-r-- 1 root root 3163 Apr 9 2021 sources.list
-rw-r--r-- 1 root root 3163 Oct 12 02:40 sources.list.bak
drwxr-xr-x 2 root root 4096 Apr 9 2020 sources.list.d/
-rw-rw-r-- 1 root root 3163 Apr 9 2021 sources.list.save
drwxr-xr-x 2 root root 4096 Feb 9 2021 trusted.gpg.d/
chen@ubuntu:/etc/apt$
更新服务器列表
先清空 sources.list 文件
echo '' > sources.list
然后加入清华源
sudo vi /etc/apt/sources.list
清华源
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security multiverse
刷新软件源信息:
sudo apt-get update #更新源列表
sudo apt-get upgrade #更新已经安装的包
sudo apt-get dist-upgrade #更新软件,升级系统
其他国内源
阿里源:
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
网易源:
deb http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse