前言
树莓派默认用的是国外的镜像源,但是在更新软件和系统的时候速度很慢,因为我们是在国内访问国外的服务器,所以需要更换成国内的镜像源。
一:备份原文件
1.备份软件源原文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

2.备份系统源原文件
sudo cp /etc/apt/sources.list.d/raspi.list /etc/apt/sources.list.d/raspi.list.bak

二:查看系统版本
输入下方代码查看版本
lsb_release -a

三:镜像源
中国科学技术大学(中科大)
http://mirrors.ustc.edu.cn/raspbian/raspbian/
阿里云
http://mirrors.aliyun.com/raspbian/raspbian/
清华大学
http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/
华中科技大学
http://mirrors.hustunique.com/raspbian/raspbian/ Arch Linux ARM http://mirrors.hustunique.com/archlinuxarm/
华南农业大学(华南用户)
http://mirrors.scau.edu.cn/raspbian/
大连东软信息学院源(北方用户)
http://mirrors.neusoft.edu.cn/raspbian/raspbian/
重庆大学源(中西部用户)
http://mirrors.cqu.edu.cn/Raspbian/raspbian/
新加坡国立大学
http://mirror.nus.edu.sg/raspbian/raspbian
牛津大学
http://mirror.ox.ac.uk/sites/archive.raspbian.org/archive/raspbian/
韩国KAIST大学
http://ftp.kaist.ac.kr/raspbian/raspbian/
四:更换软件源
1.用nano 编辑/etc/apt/
目录下的sources.list
sudo nano /etc/apt/sources.list
2.进入该界面之后,只需要更改的是绿色部分的字,先把原来的用#
注释掉

3.然后自己输入和上面格式一样的内容,镜像源可以自行选择,我用的是中科大的
deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ buster main contrib non-free rpi

4.然后按Ctrl + X
退出,然后按Y
保存更改,然后按下回车键
退出

五:更换系统源
1.用nano 编辑/etc/apt/
目录下的sources.list.d/raspi.list
sudo nano /etc/apt/sources.list.d/raspi.list

2.进入该界面之后,只需要更改的是绿色部分的字,先把原来的用#
注释掉

3.然后自己输入和上面格式一样的内容,镜像源可以自行选择,我用的是中科大的(镜像源要和之前更换的软件源一致)
deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ buster main

4.然后按Ctrl + X
退出,然后按Y
保存更改,然后按下回车键
退出
六:更新
1.更新系统
sudo apt-get update

2.更新软件
sudo apt-get upgrade

输入:Y,继续执行
