樹莓派raspiOS換源

科里布發表於2024-09-10

新裝了個樹莓派,更新時候發現連不上網,遂換國內源。由於近期AI用習慣了,就沒找官方說明,結果......果然踩雷了。所以還是得看官方提供的說明。
清華開源映象站Raspbian 軟體倉庫
1、檢視系統架構

$ uname -m
aarch64

提示aarch64使用者直接參考 Debian 幫助

Debian 軟體源

大部分 Debian 的軟體源配置檔案使用傳統的 One-Line-Style,路徑為 /etc/apt/sources.list;但是對於容器映象,從 Debian 12 開始,其軟體源配置檔案變更為 DEB822 格式,路徑為 /etc/apt/sources.list.d/debian.sources。一般情況下,將對應檔案中 Debian 預設的源地址 http://deb.debian.org/ 替換為映象地址即可。

Debian Buster 以上版本預設支援 HTTPS 源。如果遇到無法拉取 HTTPS 源的情況,請先使用 HTTP 源並安裝:

sudo apt install apt-transport-https ca-certificates

傳統格式(/etc/apt/sources.list)

# 預設註釋了原始碼映象以提高 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://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

DEB822 格式(/etc/apt/sources.list.d/debian.sources)

Types: deb
URIs: https://mirrors.tuna.tsinghua.edu.cn/debian
Suites: bookworm bookworm-updates bookworm-backports
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

# 預設註釋了原始碼映象以提高 apt update 速度,如有需要可自行取消註釋
# Types: deb-src
# URIs: https://mirrors.tuna.tsinghua.edu.cn/debian
# Suites: bookworm bookworm-updates bookworm-backports
# Components: main contrib non-free non-free-firmware
# Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

# 以下安全更新軟體源包含了官方源與映象站配置,如有需要可自行修改註釋切換
Types: deb
URIs: https://security.debian.org/debian-security
Suites: bookworm-security
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

# Types: deb-src
# URIs: https://security.debian.org/debian-security
# Suites: bookworm-security
# Components: main contrib non-free non-free-firmware
# Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

建議還是去映象站複製貼上,還可以根據選擇的架構、版本自動生成設定檔案內容。

相關文章