树莓派在国内更新软件源很慢,可以更换为国内的软件源。
1、更新/etc/apt/sources.list
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bk
sudo nano /etc/apt/sources.list
输入以下内容:
deb http://mirrors.ustc.edu.cn/debian bookworm main contrib non-free non-free-firmware
deb http://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb http://mirrors.ustc.edu.cn/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://mirrors.ustc.edu.cn/debian bookworm main contrib non-free non-free-firmware
#deb-src http://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware
#deb-src http://mirrors.ustc.edu.cn/debian bookworm-updates main contrib non-free non-free-firmware
2、更新/etc/apt/sources.list.d/raspi.list
sudo nano /etc/apt/sources.list.d/raspi.list
替换为以下内容(或者注释之前的,然后追加)
deb https://mirrors.ustc.edu.cn/archive.raspberrypi.org/debian/ bookworm main
#deb-src https://mirrors.ustc.edu.cn/archive.raspberrypi.org/debian/ bookworm main
3、更新
依次输入以下命令进行更新。
sudo apt update && sudo apt dist-upgrade
如果需要单独更新EEPROM可以参考:传送门
如果apt update出现错误:The following signatures couldn't be verified because the public key is not available: NO_PUBKEY xxxxxxxxxxxxxxxxxxx
使用以下命令添加KEY:
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com xxxxxxxxxxxxxxxxxxx
文章评论
树莓派64位换源以后可能下不了软件,想知道博主有没有解决的办法
@Billion 64位镜像可以直接使用debian的系统源,首先需要编辑/etc/apt/sources.list,使用#号注释原内容,然后在末尾添加Debian的系统源:
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
接着需要配置树莓派官方的软件源,编辑/etc/apt/sources.list.d/raspi.list,同样的,注释原内容,在末尾添加如下内容:
deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui
系统源和软件源配置完成以后,使用下述两条命令更新:
sudo apt update
sudo apt upgrade -y