树莓派 · 2022年3月20日 0

树莓派 替换国内镜像

由于raspberry源对64位Pi OS支持不完整,所以 sources.list需要使用debian源,而32位的直接使用raspberry源就可以

1、备份源文件

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo cp /etc/apt/sources.list.d/raspi.list /etc/apt/sources.list.d/raspi.list.bak

2、修改源文件

32位Pi OS

修改 sources.list 文件

# 修改apt源
sudo vim /etc/apt/sources.list

deb http://mirrors.tuna.tsinghua.edu.cn/raspberry-pi-os/raspbian/ buster main non-free contrib rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspberry-pi-os/raspbian/ buster main non-free contrib rpi

# 修改树莓派源
sudo vim /etc/apt/sources.list.d/raspi.list

deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui

64位Pi OS

# 修改apt源
sudo vim /etc/apt/sources.list

deb https://mirrors.tuna.tsinghua.edu.cn/debian buster main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ buster/updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian buster-updates main contrib non-free

# 修改树莓派源
sudo vim /etc/apt/sources.list.d/raspi.list

deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui

同步更新源、软件包

sudo apt-get update
sudo apt-get upgrade