Skip to content

Commit 4734a06

Browse files
committed
debian-security: Add new security config for mirrorlist
1 parent 2284c9e commit 4734a06

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

‎debian-security/mirrorlist.zh.md‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## 自动选择软件源镜像
2+
3+
[mirrorz-302](https://github.com/mirrorz-org/mirrorz-302) 提供 mirrorlist 接口,会根据你的地理位置、网络、ISP 等条件返回按可用性排序的镜像列表,客户端到列表中排在最前面的镜像拉取软件包,当排在前面的镜像不可用时还会自动回退到后续镜像。相比手动配置单一镜像地址,这种方式能自动为你选择网络条件最佳的镜像。
4+
5+
该接口需要 APT 1.6 及以上版本(即 Debian 10 buster 及以上)。
6+
7+
默认启用“安全更新使用官方索引”,在安全更新的 mirrorlist URL 中添加 `?official_index=1`,优先从官方源获取索引,再按镜像列表的顺序下载软件包;如果镜像站尚未同步所需软件包,会回退到官方源。官方索引不可用时,APT 也会尝试镜像站的索引。没有可用镜像时,列表仍保留官方源。关闭此选项只会移除该参数,索引和软件包都由 mirrorlist 中的镜像站提供。
8+
9+
### 传统格式(`/etc/apt/sources.list`)
10+
11+
```{ztmpl lang="properties" input="release src nf official_index"}
12+
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
13+
deb mirror+{{scheme}}://mirrors.cernet.edu.cn/api/apt/mirrorlist/debian-security{{#official_index}}?official_index=1{{/official_index}} {{release}}{{security}} main contrib{{#nf}}{{nonfree}}{{/nf}}
14+
{{src}}deb-src mirror+{{scheme}}://mirrors.cernet.edu.cn/api/apt/mirrorlist/debian-security{{#official_index}}?official_index=1{{/official_index}} {{release}}{{security}} main contrib{{#nf}}{{nonfree}}{{/nf}}
15+
```
16+
17+
### DEB822 格式(`/etc/apt/sources.list.d/debian.sources`)
18+
19+
```{ztmpl lang="yaml" input="release_deb822 src nf official_index"}
20+
Types: deb
21+
URIs: mirror+{{scheme}}://mirrors.cernet.edu.cn/api/apt/mirrorlist/debian-security{{#official_index}}?official_index=1{{/official_index}}
22+
Suites: {{release_deb822}}-security
23+
Components: main contrib{{#nf}} non-free non-free-firmware{{/nf}}
24+
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
25+
26+
{{src}}Types: deb-src
27+
{{src}}URIs: mirror+{{scheme}}://mirrors.cernet.edu.cn/api/apt/mirrorlist/debian-security{{#official_index}}?official_index=1{{/official_index}}
28+
{{src}}Suites: {{release_deb822}}-security
29+
{{src}}Components: main contrib{{#nf}} non-free non-free-firmware{{/nf}}
30+
{{src}}Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
31+
```

‎debian-security/zh.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,8 @@ input:
3838
_: 使用非自由软件源
3939
default: true
4040
true:
41+
official_index:
42+
_: 安全更新使用官方索引
43+
note: 优先获取官方索引,软件包优先从镜像站下载,失败时回退到官方源
44+
default: true
45+
true:

0 commit comments

Comments
 (0)