skip to content
Logo 裁晨

树莓派Raspberry Pi OS安装与切换国内源

/ 2 min read

Table of Contents

系统安装

  1. 系统镜像下载 附官网地址
  2. 下载balenaEtcher进行系统镜像烧录 image.png
  3. 烧录完成后在 boot 盘中创建wpa_supplicant.conf文件连接 wifi,或使用网线连接
country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="iPhone"
psk="104104104"
key_mgmt=WPA-PSK
priority=1
}
  1. 创建ssh文件可进行 ssh 连接

树莓派开机后切换国内源

  1. 系统环境查询
cat /etc/os-release
uname -a

image.png 2. 修改/etc/apt/sources.list文件,注释原有源,并粘贴

sudo nano /etc/apt/sources.list
deb https://mirror.nju.edu.cn/debian/ bullseye main contrib non-free
deb https://mirror.nju.edu.cn/debian-security/ bullseye-security main contrib non-free
deb https://mirror.nju.edu.cn/debian bullseye-updates main contrib non-free
  1. 修改文件/etc/apt/sources.list.d/raspi.list
deb https://mirror.nju.edu.cn/raspberrypi/debian/ bullseye main
  1. 测试
sudo apt update
sudo apt upgrade

解决切换源问题

  1. 如果出现he following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9165938D90FDDD2E执行下列命令添加公钥即可
gpg --keyserver keyserver.ubuntu.com --recv-keys 9165938D90FDDD2E
gpg --export --armor 9165938D90FDDD2E | sudo apt-key add -

2.出现Temporary failure resolving问题,修改/etc/resolv.conf文件如下

image.png