树莓派debian 12更换清华镜像源
2023-10-16 本文已影响0人
格林童话ol
树莓派系统安装后默认使用国外的镜像源,因为墙的原因,所以在安装模块的时候速度非常慢,因此需要将镜像源换成国内的。
系统版本
@rasp:/etc/apt $ uname -m
aarch64
@rasp:/etc/apt $ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm
清华大学镜像源:https://mirrors.tuna.tsinghua.edu.cn/help/raspbian/
清华镜像源推荐aarch64参考Debian帮助
aarch64
aarch64 用户可直接参考 Debian 帮助
因此直接跳转到https://mirrors.tuna.tsinghua.edu.cn/help/debian
启用源码镜像和使用官方安全更新软件源都选择否 得到如下镜像源
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
# deb-src 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-src 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-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
# deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
# # deb-src https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
1.备份sources.list文件
cp /etc/apt/sources.list /etc/apt/sources.list.bak
2.打开配置sources.list文件
sudo nano /etc/apt/sources.list
使用#注释掉或者删除原来的镜像源
将上面获取到的地址复制进去
Ctrl + O 然后回车确认 保存 再 Ctrl + X 退出
3.打开配置raspi.list文件(也可以备份一份)
sudo nano /etc/apt/sources.list.d/raspi.list
将里面的源网址替换成清华镜像源http://mirror.tuna.tsinghua.edu.cn/raspberrypi/网址,其他的不动
deb http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ bookworm main
保存退出
4.控制台输入以下指令添加公钥
gpg --keyserver keyserver.ubuntu.com --recv-keys 9165938D90FDDD2E
gpg --export --armor 9165938D90FDDD2E | sudo apt-key add -
- 编辑镜像站后,使用命令更新
sudo apt-get update
sudo apt-get upgrade