找回密码
 立即注册
搜索
查看: 109|回复: 0

[系统] 国内有几个提供 Debian 镜像的站点

[复制链接]

4618

主题

695

回帖

4万

积分

版主

积分
45510
发表于 2026-6-28 09:11:48 | 显示全部楼层 |阅读模式
本帖最后由 达耳闻 于 2026-6-28 09:13 编辑 , X8 Y; c( o5 [+ @* ^8 J8 `

: M" H2 l4 m" v阿里云 https://mirrors.aliyun.com/debian/ 速度快,覆盖广,国内主流选择之一 所有用户
8 [6 m$ k  g6 u, ^# F清华大学 https://mirrors.tuna.tsinghua.edu.cn/debian/ 教育网优化,更新及时,支持IPv6 教育网用户
- `- u1 ?) ^7 R1 Y& i& D中科大 https://mirrors.ustc.edu.cn/debian/ 历史悠久,连接稳定,尤其适合华中、华东地区 华中、华东用户2 W* K9 B6 G# U6 ~" w$ ^# d8 W
华为云 https://mirrors.huaweicloud.com/debian/ 企业级服务,稳定性强 企业用户+ h: q* O5 T6 `- k) Y* V; X
网易: http://mirrors.163.com/debian/ 老牌镜像站,稳定可靠 所有用户
: u1 B% J/ E5 e" }4 Y腾讯云 https://mirrors.cloud.tencent.com/debian/ 云服务商提供,与云产品集成良好 腾讯云用户5 q* @( S" y1 f( y- p* Q: Z) i3 D1 _

7 u& r/ _# Q  G0 G7 a3 E/ l5 b6 J9 h) M5 q

( e, {* k4 G9 _- k) |; g1 b; A4 _更换镜像源方法
$ n/ \8 Q0 k# W" c1 i你有多种方法可以更换镜像源。
3 D- b: H: |$ ]. b7 f! U
4 u0 F# k8 K0 K. g: x6 Z方法一:手动编辑源列表文件(推荐,更灵活)& L5 n/ v: o6 B. w. K) Y( Y2 G
编辑 sources.list 文件:
4 \5 S# F$ }; i; F" b$ g+ n5 x9 K- d  k5 P+ }
sudo nano /etc/apt/sources.list
7 b5 |$ k' D$ b8 t注释或删除原有内容,添加以下对应内容(以阿里云和清华大学为例,注意将 trixie 替换为你实际的 Debian 版本代号):( g/ e1 ^( }0 }' W9 E6 v( F
; |5 ?, ^1 t' x9 n" Z# r
阿里云镜像源示例(传统格式):
$ E9 \! H2 _- t. I8 b& Q
/ S  k, T7 z  C8 R. z2 V4 H; Qdeb https://mirrors.aliyun.com/debian/ trixie main contrib non-free non-free-firmware
6 ^& N$ _# N9 `) D0 g! ?9 Mdeb-src https://mirrors.aliyun.com/debian/ trixie main contrib non-free non-free-firmware
) L3 `' ?* J9 [3 J( p  j- W+ J" \, j: e
deb https://mirrors.aliyun.com/debian/ trixie-updates main contrib non-free non-free-firmware
+ F' G* J- G* D3 I5 U5 s4 {0 Bdeb-src https://mirrors.aliyun.com/debian/ trixie-updates main contrib non-free non-free-firmware2 I% _; x$ D* v
+ W# P' l) p  X& z. m% v- g* [( L
deb https://mirrors.aliyun.com/debian/ trixie-backports main contrib non-free non-free-firmware  b& H) Q( f  G- c
deb-src https://mirrors.aliyun.com/debian/ trixie-backports main contrib non-free non-free-firmware
8 W$ E2 |; A0 `. a. }* p' O. A2 k: O6 d0 B
# 安全更新源$ c  d7 x( M! M$ e' r% G2 a/ l
deb https://mirrors.aliyun.com/debian-security trixie-security main contrib non-free non-free-firmware
4 z8 U1 U  S; c0 B6 J4 Cdeb-src https://mirrors.aliyun.com/debian-security trixie-security main contrib non-free non-free-firmware  l( i' t% [6 `" e5 [5 R
清华大学镜像源示例(传统格式):: J+ j; A4 w- \$ V6 I
5 J" [9 c) A5 P- ?' W( x
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie main contrib non-free non-free-firmware
7 j. B* m2 U. k1 Y4 @% zdeb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie main contrib non-free non-free-firmware
/ ^7 u/ p8 r' U, Y. E3 U" b4 ?) u3 Q% t# [2 d/ @0 v
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-updates main contrib non-free non-free-firmware' T5 m: V9 x( _% S
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-updates main contrib non-free non-free-firmware
( z: O6 `$ V; w& U9 o  \% s
' `; g3 e4 Q# f5 n" ^deb https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-backports main contrib non-free non-free-firmware
- b* k- f$ b+ O: e7 edeb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-backports main contrib non-free non-free-firmware
( e- S' p# U% q: Z# 安全更新源3 p& i& u# I% `$ U1 x
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security trixie-security main contrib non-free non-free-firmware% ^" v9 O. P  M1 N0 A/ I" D+ W* q- w
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security trixie-security main contrib non-free non-free-firmware+ H, u" j' F4 y) w$ P: q
保存并退出编辑器(在 nano 中按 Ctrl+X,然后按 Y 确认,最后按 Enter)。; [% a* B  [+ L$ i. n. @, h

: _- W2 Z+ b3 D2 c更新软件包列表:
3 M1 @1 A  @- M* h- k5 ?
3 a+ F, J4 x% d& X" ?7 Psudo apt update
+ x! \' N9 j% j特点:最灵活的方法,可以精确控制每个源,适合高级用户和特殊需求。
1 i0 s9 ?- a* A+ [- w, r
; {% l! [; `5 c% u  C' q+ p5 K方法二:使用 DEB822 格式(新格式,Debian 12 及以上支持)" t, A% b5 }. T' |+ w! Z# \
从 Debian 12 开始,系统支持新的 DEB822 格式的源文件,存储在 /etc/apt/sources.list.d/ 目录下,后缀为 .sources。
3 [& B7 y3 q! D7 w' ], I$ L9 I" H
创建或编辑 .sources 文件,例如:
1 i9 [& x% N+ V/ B
( ^/ p: c/ @; g6 z0 t1 D0 r8 Z$ Zsudo nano /etc/apt/sources.list.d/debian.sources
  U- p2 L7 e9 t2 _# ?添加以下内容(以清华大学源为例,DEB822 格式):  j7 }& G1 @  m
% l; J  b4 K6 q8 M: d; b
Types: deb deb-src
$ v/ _8 `( z9 \9 x1 eURIs: https://mirrors.tuna.tsinghua.edu.cn/debian0 I2 M: a0 j: P6 f
Suites: trixie trixie-updates trixie-backports
6 E9 M" P0 v% z  J+ KComponents: main contrib non-free non-free-firmware: B" q% g! K5 N* `! X
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
; w7 g3 J4 I+ a% q
( y& {9 e  ?# B' _; R# ^; pTypes: deb deb-src
, e4 v" f( ^( h6 jURIs: https://mirrors.tuna.tsinghua.edu.cn/debian-security
( b) u! B8 ?+ ^: ~; t" ISuites: trixie-security* e/ |9 N- w/ a' k
Components: main contrib non-free non-free-firmware
. {! ?. w: }0 ]$ p7 e& L# F0 NSigned-By: /usr/share/keyrings/debian-archive-keyring.gpg
- {! f. _- P/ e你也可以选择禁用传统的 sources.list 文件(可选):
- f" x% g5 }/ h, x) o7 S4 O" x) q) e4 H) @
sudo mv /etc/apt/sources.list /etc/apt/sources.list.disabled- l% _% w3 d  S& }1 A# [$ K3 U
更新软件包列表:( l0 ~+ q4 |0 U4 ]
5 v/ ^% N% ~# N1 f9 I
sudo apt update" K9 t6 @* g2 S& `' x+ w, K. ?
特点:新格式更易读和管理,支持多架构和更复杂的源配置,是未来的发展方向。, P6 z2 I% q3 q! E  R

( D' j" |- n* |3 p8 z9 w: Y注意事项# j- p% |5 x2 B; M6 C% K
确认 Debian 版本代号:确保配置中使用的版本代号(如 trixie)与你实际运行的 Debian 版本一致。可通过 lsb_release -cs 命令查看。
1 E8 t5 Y, m, d* O# @! N% n: {4 r
% a- _4 m6 R  K安全更新源的选择:出于及时性考虑,安全更新(security)建议直接使用 Debian 官方源( https://security.debian.org/debian-security ),因为镜像站同步可能存在延迟。若镜像站提供了安全更新源且你追求速度,也可使用,但需知晓潜在风险。
+ b, `  j7 k- W: A7 f2 H; {
' |  l* }; N6 v, g4 d网络问题:如果遇到 Connection reset by peer 等错误,可能与 HTTP Pipelining 特性有关,可以尝试关闭它:
+ R8 f5 ^: d: X' y
* D( m' y4 C5 U# M4 d1 ^2 _, H4 Vecho "Acquire::http:ipeline-Depth \"0\";" | sudo tee /etc/apt/apt.conf.d/99nopipelining( B; M9 w0 y* n( b5 v8 t
镜像站同步延迟:镜像站与官方源之间存在同步时间差,通常较短。若更新时找不到某些最新软件包,可稍后再试。
+ v' P4 {. Y2 P- ^; O1 _- V1 g1 K, C5 ^6 d  H9 n
代理设置:如果你处于网络受限环境,可能需要配置 HTTP/HTTPS 代理才能访问特定镜像源。
0 b, R* \3 ~$ \0 k) M, Q
6 Z! A$ D+ i5 V' ]% L% I多架构支持:如果你需要安装 i386 等多架构软件包,确保源配置中包含相应组件。
( ]4 M* x0 @1 Q/ D0 T: a8 t% o7 k" t" K/ @2 P6 Y
第三方源:更换系统源后,别忘了也更新第三方软件的源配置(如 Docker、Google Chrome 等),将它们也指向国内镜像。. Y5 j) \2 F) K+ P7 h

/ ^9 X% h. G8 B3 ?# g! ]: ?测试与验证& g' [4 a6 ?7 z$ j6 i
更新软件包列表:执行 sudo apt update 后,观察是否有错误信息。若无错误,且列出了新的镜像源地址,则通常表示配置成功。) j1 s2 T" |6 D1 N3 k6 R3 ?
0 {/ y! t7 {2 y) r2 R9 D
速度测试:使用以下命令测试下载速度:. p. k. C1 |, U$ p

5 p& f7 o6 O6 a, t; Csudo apt install speedtest-cli
2 F2 m% K2 O3 A! Gspeedtest
- g" T; k% a- Q7 `安装测试:尝试安装或更新一个软件包(如 sudo apt install htop),感受下载速度是否有所提升。
8 }' F0 K7 L+ O& ]* `查看源设置:通过 apt policy <package-name> 可查看软件包具体会从哪个源获取。
% W! p9 {9 {% u/ G, R验证签名:确保所有软件包都能正确验证签名,没有警告信息。# A; r8 A* X' B8 f0 B
2 v. [3 g9 m; v; O
推荐策略:
- f( B3 z; P% W  i/ W3 q9 {/ |3 o# j" C8 a! [! y2 E* a! K  F
请注意,镜像源的可用性和速度可能因时间和网络环境而异。如果遇到问题,不妨回退备份或尝试另一个镜像源。定期检查镜像站的状态页面也是好习惯。
& n3 j, y* n/ M1 D' Y! ]3 X
4 ]- e2 c- Q2 G
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

无图|手机版|日常生活

© 2021-2026 THEDAILYLIVES.COM

快速回复 返回顶部 返回列表