众所周知,因为一些不可抗因素,树莓派在更新时需要切换到国内镜像源来方便进行操作
默认源
我们可以使用以下命令打开源配置文件
sudo nano /etc/apt/sources.list
之后可以看到如下信息
deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
deb http://deb.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
# Uncomment deb-src lines below then 'apt-get update' to enable 'apt-get source'
#deb-src http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
#deb-src http://deb.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware
#deb-src http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
有的情况下还需要修改另一个配置(大多数情况下不修改也可以)
sduo nano /etc/apt/sources.list.d/raspi.list
可以看到如下信息
deb http://archive.raspberrypi.com/debian/ bookworm main
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspberrypi.com/debian/ bookworm main
国内源
我们只需要修改第一个配置文件,修改为阿里云的源(实测这个源比较完整,更新比较及时)
我习惯使用nano来当编辑器,Ctrl + O为保存,ctrl + X为退出
deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
之后执行
sudo apt-get update
sudo apt-get upgrade
即可更新升级树莓派
安装软件也会比之前使用默认源要快不少,基本上能跑满带宽
树莓派修改时间sudo dpkg-reconfigure tzdata