树莓派5 bookworm初学:更换国内源以及可能会遇到问题
树莓派5的官方的发版说明里明确注明基于Debian Bookworm,因此修改国内源的方式也有所改变,但总体大差不差。
首先连接好树莓派(包括网线、电源什么的)在查询到树莓派IP地址后,通过putty连接到树莓派。
首先使用sudo nano /etc/apt/sources.list进入
在进入后注释掉第一行代码(也就是加个#号)因为它是国外源的代码。然后复制粘贴
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware

在修改完成后,按ctrl + o进行保存,然后回车,然后ctrl+x退出。
然后使用sudo nano /etc/apt/sources.list.d/raspi.list进入后
依旧是将第一行代码注释掉然后输入
deb https://mirrors.tuna.tsinghua.edu.cn/raspberrypi bookworm main

完成之后按ctrl + o进行保存,然后回车,然后ctrl+x退出。
最后使用sudo apt-get update和sudo apt-get upgrade测试一下是否成功就行。
如果update时出现The repository 'https://mirrors.tuna.tsinghua.edu.cn/debian bookworm-updates InRelease' is not signed.说明这个源又不能使用了,需要到
https://mirrors.tuna.tsinghua.edu.cn/help/debian/
这个网站里找最新的源。
如果在update时出现 gpg: no writable keyring found: Not found说明是没有公钥报错这个时候可以先找一下例如NO_PUBKEY 9165938D90FDDD2E
然后就输入
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9165938D90FDDD2E
公钥全部录入完成后再进行尝试
更多推荐
所有评论(0)