Files
any-hub/specs/007-apt-apk-cache/quickstart.md
2025-11-18 09:55:07 +08:00

43 lines
988 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Quickstart: APT/APK 缓存代理
## 1) 启用新 Hub
`config.toml` 增加示例:
```toml
[[Hub]]
Domain = "apt.hub.local"
Name = "apt"
Port = 5001
Upstream = "https://mirrors.edge.kernel.org/ubuntu"
Type = "debian"
Module = "debian" # 待实现模块键
[[Hub]]
Domain = "apk.hub.local"
Name = "apk"
Port = 5002
Upstream = "https://dl-cdn.alpinelinux.org/alpine"
Type = "apk"
Module = "apk" # 待实现模块键
```
## 2) 指向代理
- APT`/etc/apt/sources.list` 中的 `http://apt.hub.local:5001` 替换官方源域名(需匹配 suite/component 路径)。
- APK`/etc/apk/repositories` 中写入 `http://apk.hub.local:5002/v3.19/main` 等路径。
## 3) 验证
```bash
# APT
apt-get update
apt-get install -y curl
# Alpine
apk update
apk add curl
```
观察 `logs/` 输出:首次请求应为回源,二次请求命中缓存(索引可能返回 304。如上游不可达且缓存已有包体应继续命中缓存无缓存则透传错误。