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

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

[复制链接]

4071

主题

693

回帖

4万

积分

版主

积分
41419
发表于 昨天 09:11 | 显示全部楼层 |阅读模式
本帖最后由 达耳闻 于 2026-6-28 09:13 编辑 ( ]# @" x: ?( ?1 R
, ?8 h5 Q4 y# m% o, a
阿里云 https://mirrors.aliyun.com/debian/ 速度快,覆盖广,国内主流选择之一 所有用户$ |5 ?; ^& S6 g9 Y
清华大学 https://mirrors.tuna.tsinghua.edu.cn/debian/ 教育网优化,更新及时,支持IPv6 教育网用户; K: Y2 V0 j  W& B! W: G
中科大 https://mirrors.ustc.edu.cn/debian/ 历史悠久,连接稳定,尤其适合华中、华东地区 华中、华东用户
. f4 k+ G8 Q& J) `3 V" n- n$ k华为云 https://mirrors.huaweicloud.com/debian/ 企业级服务,稳定性强 企业用户
& G0 W2 l$ f7 G7 d# d网易: http://mirrors.163.com/debian/ 老牌镜像站,稳定可靠 所有用户
: Q5 \5 Y( C7 Y5 _0 B1 X腾讯云 https://mirrors.cloud.tencent.com/debian/ 云服务商提供,与云产品集成良好 腾讯云用户
' [$ d' ^7 f1 t  c7 j$ S8 U1 H4 Q/ c8 j" R/ x: H2 P9 R
) }: `9 R0 k9 P& k4 c- f9 `; F4 d

! v& |0 X, ~) b9 Y! L7 s更换镜像源方法7 a/ H5 b% c$ g0 x
你有多种方法可以更换镜像源。
8 R) I3 N9 f2 _5 ~6 }# W% y& ]2 [% g( q1 ^$ r" h
方法一:手动编辑源列表文件(推荐,更灵活): j- m8 y1 s. A1 _" G
编辑 sources.list 文件:
+ ?  n" W" f" e9 m' |
# K* K) x8 k7 `$ N, Hsudo nano /etc/apt/sources.list
+ O5 d9 c4 p$ ^注释或删除原有内容,添加以下对应内容(以阿里云和清华大学为例,注意将 trixie 替换为你实际的 Debian 版本代号):
" h8 h2 `6 L* j- d& n' y5 a
* V$ C" {1 \. a, m  e  X. H阿里云镜像源示例(传统格式):
: J4 B' P+ G8 R+ I7 x% h) O, y& |$ p2 k1 G" C
deb https://mirrors.aliyun.com/debian/ trixie main contrib non-free non-free-firmware  E$ |) Y, U6 z
deb-src https://mirrors.aliyun.com/debian/ trixie main contrib non-free non-free-firmware6 A) C; e  X4 ]+ M1 P- H* \
( i4 U0 O) y4 d" t# p* N0 p
deb https://mirrors.aliyun.com/debian/ trixie-updates main contrib non-free non-free-firmware
5 {; \) u% r7 U% v4 W2 Vdeb-src https://mirrors.aliyun.com/debian/ trixie-updates main contrib non-free non-free-firmware
4 X" S" b2 a. ?/ [) d5 u0 S. l" \6 f$ v( H$ {3 z
deb https://mirrors.aliyun.com/debian/ trixie-backports main contrib non-free non-free-firmware
  H* e, J/ f& v. r4 B( J: G* ?$ D5 Wdeb-src https://mirrors.aliyun.com/debian/ trixie-backports main contrib non-free non-free-firmware- a9 V" U5 f1 i
6 `7 Z7 c8 U7 {1 a. A
# 安全更新源
$ e# P8 Y, c% A$ ldeb https://mirrors.aliyun.com/debian-security trixie-security main contrib non-free non-free-firmware
+ I5 g  g! a2 K8 y- l+ odeb-src https://mirrors.aliyun.com/debian-security trixie-security main contrib non-free non-free-firmware
2 g. o& Z# J# u清华大学镜像源示例(传统格式):
4 P# }6 a5 I- G5 }6 P% @0 r* N0 B0 ]$ k
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie main contrib non-free non-free-firmware
4 F' d8 {9 N' Y: ]deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie main contrib non-free non-free-firmware8 `0 l  z$ E$ M: a) R
' i7 S6 }% r' z6 A" L1 |, {' E& U
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-updates main contrib non-free non-free-firmware' V2 i, P6 f% g9 V, _9 q9 E2 l5 W
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-updates main contrib non-free non-free-firmware2 a. X! i8 o- ?9 I4 {* b8 y
1 i& j; h. b$ N# F# c. C
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-backports main contrib non-free non-free-firmware
) b" j: @( f: G# y; D0 H3 \deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-backports main contrib non-free non-free-firmware
! l5 o+ X4 @1 @5 Q/ ~# 安全更新源; r1 V) \( _% H: V1 E
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security trixie-security main contrib non-free non-free-firmware
' D* X: E; O% |$ R# L1 ddeb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security trixie-security main contrib non-free non-free-firmware, Z: @( _" o( p3 y  q
保存并退出编辑器(在 nano 中按 Ctrl+X,然后按 Y 确认,最后按 Enter)。0 K- i0 m  d/ n9 w; o

% D9 N7 d  r( k- B3 C( |! U更新软件包列表:3 h) E* L# A7 y' d+ R: x+ I. a' l$ t

4 q' |$ g9 X3 Z% g* R5 v7 n$ usudo apt update
5 V! y( k1 o  }" W9 M- O特点:最灵活的方法,可以精确控制每个源,适合高级用户和特殊需求。
1 u/ X' f& k  O% g/ P
' D$ L2 r2 A! ]8 H方法二:使用 DEB822 格式(新格式,Debian 12 及以上支持): y' u& D& h' T. k3 C
从 Debian 12 开始,系统支持新的 DEB822 格式的源文件,存储在 /etc/apt/sources.list.d/ 目录下,后缀为 .sources。2 c& D0 X5 x, E6 R; f6 b- K

$ c7 H0 @: r, \5 a创建或编辑 .sources 文件,例如:
; j! V) `- I7 X2 D$ \0 _1 |; z: X- H' T" L
sudo nano /etc/apt/sources.list.d/debian.sources6 |$ C" t8 g5 Y
添加以下内容(以清华大学源为例,DEB822 格式):
2 g; M) J: i6 G5 J% Y2 Q; Q. V  T+ X5 `
Types: deb deb-src
6 G9 J) H- i3 n4 s. nURIs: https://mirrors.tuna.tsinghua.edu.cn/debian2 k9 H- ^9 n4 S( n- L& {9 f
Suites: trixie trixie-updates trixie-backports
, [$ {2 G: x( gComponents: main contrib non-free non-free-firmware6 ?' n$ t% S  s3 v3 E' o& g5 |
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg. J& ^8 w( {7 _2 K

" I) ?) }/ B$ B9 S2 a2 U  hTypes: deb deb-src. }- y( b  W  @& K/ u  q
URIs: https://mirrors.tuna.tsinghua.edu.cn/debian-security
! `5 y( s9 o  \' X0 }& YSuites: trixie-security
2 b) F6 f" m8 `7 e8 ?Components: main contrib non-free non-free-firmware
& i  h* O/ x+ _  y' sSigned-By: /usr/share/keyrings/debian-archive-keyring.gpg
  @" p; T. J! w- ]: T8 ]+ n你也可以选择禁用传统的 sources.list 文件(可选):
- A- G, _2 e. K5 Z# V/ ]( q# }+ |: G
- I; ~7 e0 ~. Q7 i  }9 N1 c/ h' Asudo mv /etc/apt/sources.list /etc/apt/sources.list.disabled0 W8 J! k2 Q0 L  L
更新软件包列表:
6 L9 S  A( j2 t6 s9 v5 N7 B% m0 r- g- _( n; _8 V" R4 t& u& ?0 d. h
sudo apt update
- ^' S6 W2 {3 l特点:新格式更易读和管理,支持多架构和更复杂的源配置,是未来的发展方向。
  B: t' J. p2 X! |; B0 h# D8 T' |6 P9 M5 X- g5 g
注意事项/ ?/ f: I( \: I" w/ z% q( Y
确认 Debian 版本代号:确保配置中使用的版本代号(如 trixie)与你实际运行的 Debian 版本一致。可通过 lsb_release -cs 命令查看。
2 n9 l$ a! E  c! l' r* ]( C
# Z# u. t3 {+ D, q2 O7 n  ]安全更新源的选择:出于及时性考虑,安全更新(security)建议直接使用 Debian 官方源( https://security.debian.org/debian-security ),因为镜像站同步可能存在延迟。若镜像站提供了安全更新源且你追求速度,也可使用,但需知晓潜在风险。$ }* a7 a2 d, x; J8 f+ A1 H

& n. T; A2 P8 E网络问题:如果遇到 Connection reset by peer 等错误,可能与 HTTP Pipelining 特性有关,可以尝试关闭它:) W& }* O* j  h8 |/ ]
) v& R: O8 J$ m7 l5 Y8 y( p* j: F) s
echo "Acquire::http:ipeline-Depth \"0\";" | sudo tee /etc/apt/apt.conf.d/99nopipelining
: ~: [9 x; G1 `$ c2 T+ k镜像站同步延迟:镜像站与官方源之间存在同步时间差,通常较短。若更新时找不到某些最新软件包,可稍后再试。! C& Q3 R$ y/ o( [) D1 e/ h( T

) M8 B. G5 y  F5 P4 r代理设置:如果你处于网络受限环境,可能需要配置 HTTP/HTTPS 代理才能访问特定镜像源。3 [$ o. d$ E4 A$ h
& P" Q) H, s) w/ t# x" m: r: ?1 i9 n2 v
多架构支持:如果你需要安装 i386 等多架构软件包,确保源配置中包含相应组件。! @0 Q: }, G' L  C; G# N
' b4 ]  V" x6 w( S2 @* s
第三方源:更换系统源后,别忘了也更新第三方软件的源配置(如 Docker、Google Chrome 等),将它们也指向国内镜像。, m) i6 I" ^% `2 D6 l" ^7 \

! X  @4 q6 c$ I0 |: p0 @测试与验证- t4 I( ^& C2 d$ u- y+ j
更新软件包列表:执行 sudo apt update 后,观察是否有错误信息。若无错误,且列出了新的镜像源地址,则通常表示配置成功。! ]7 ~! v% U1 o6 N$ b% t! ^

4 P* m% ^. t: O7 G$ f/ y速度测试:使用以下命令测试下载速度:
) I# m5 \% N, V! j* {7 a  L: g* K; ?0 G5 u
sudo apt install speedtest-cli0 s* a2 a  G) w1 T1 O
speedtest1 }9 p; L9 t! T" U
安装测试:尝试安装或更新一个软件包(如 sudo apt install htop),感受下载速度是否有所提升。' u, j- @6 b) s
查看源设置:通过 apt policy <package-name> 可查看软件包具体会从哪个源获取。
% N' {/ O4 z+ e8 b验证签名:确保所有软件包都能正确验证签名,没有警告信息。7 Z: U. i# y5 k3 F& L

- e: ^8 K( q% h' t3 N* J推荐策略:
+ H! S/ k9 ]' D: e6 Z7 Z
) Y) L" V  J- s( r: M+ M! o请注意,镜像源的可用性和速度可能因时间和网络环境而异。如果遇到问题,不妨回退备份或尝试另一个镜像源。定期检查镜像站的状态页面也是好习惯。/ K* i1 z5 }- J( u

0 L7 |2 i9 ?3 Q! @, Z/ w. o3 `" @
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

无图|手机版|日常生活

© 2021-2026 THEDAILYLIVES.COM

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