惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
SecWiki News
SecWiki News
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
量子位
M
MIT News - Artificial intelligence
GbyAI
GbyAI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
TaoSecurity Blog
TaoSecurity Blog
博客园 - 【当耐特】
H
Heimdal Security Blog
腾讯CDC
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News: Ask HN
Hacker News: Ask HN
S
Schneier on Security
Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
博客园 - 司徒正美
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Cybersecurity and Infrastructure Security Agency CISA
S
SegmentFault 最新的问题
大猫的无限游戏
大猫的无限游戏
Application and Cybersecurity Blog
Application and Cybersecurity Blog
F
Full Disclosure
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Threatpost
月光博客
月光博客
A
Arctic Wolf
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
雷峰网
雷峰网
T
Troy Hunt's Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Cloudflare Blog
D
DataBreaches.Net
O
OpenAI News
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
小众软件
小众软件
V
Vulnerabilities – Threatpost
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
T
The Exploit Database - CXSecurity.com
Martin Fowler
Martin Fowler
美团技术团队
P
Privacy International News Feed

烧饼博客

Ubuntu 24.04 Noble 升级 Ubuntu 26.04 Resolute WSL 2 使用 Docker 桥接模式网络访问 HTTPS 超时的解决方法 Debian / Ubuntu 下使用 nginx-acme 自动签发并配置 SSL 证书 使用 acme.sh 配置 Let's Encrypt 签发的 IP 地址 SSL 证书 RDAP.SS - 基于 RDAP 协议的 Whois 查询网站 升级 Debian 后 GitLab PostgreSQL 无法启动的解决方法 Debian 12 Bookworm 升级 Debian 13 Trixie Ubuntu 22.04 Jammy 升级 Ubuntu 24.04 Noble Docker 安装 FreshRSS 教程 Docker 安装 Shlink 自建短网址 Debian 安装 Nextcloud 服务端 Debian 双栈网络时开启 IPv4 优先 Debian / Ubuntu 使用源安装 LAMP 教程 Debian / Ubuntu 使用源安装 LEMP 教程
Debian 使用 extrepo 配置第三方软件源
Showfom · 2025-10-21 · via 烧饼博客
Debian 使用 extrepo 配置第三方软件源

本文将指导如何在 Debian 下使用 extrepo 配置第三方软件源。

#什么是 extrepo?

extrepo 用于管理 Debian 中的外部软件源。

在没有 extrepo 之前,想要使用未被 Debian 官方打包的软件,用户通常需要手动编写 APT 配置文件、以 root 身份运行未经签名的脚本,或安装一个包含所有系统配置的未签名 .deb 包。

遗憾的是,这些方法都不是很安全。

打个比方,我们要添加 Docker 的软件源,有三种方式。

第一种是传统的 One-Line Style

curl -sSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor > /usr/share/keyrings/docker-ce.gpg

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-ce.gpg] https://download.docker.com/linux/debian $(lsb_release -sc) stable" | sudo bash -c 'cat > /etc/apt/sources.list.d/docker-ce.list'

sudo apt update
sudo install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y

第二种是新的 DEB822 格式:

curl -sSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor > /usr/share/keyrings/docker-ce.gpg

sudo bash -c 'cat > /etc/apt/sources.list.d/docker-ce.sources << EOF
Components: stable
Architectures: $(dpkg --print-architecture)
Suites: $(lsb_release -cs)
Types: deb
Uris: https://download.docker.com/linux/debian
Signed-By: /usr/share/keyrings/docker-ce.gpg
EOF'

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y

第三种方法则更为简单粗暴,直接运行脚本:

curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh

在以上这些方法中(包括第三种脚本方式),我们都需要手动下载并导入 GPG 密钥,创建必要的 APT 配置文件,更新软件列表,然后再安装软件。而我们推荐使用 extrepo 的话,只需要简单的三个命令即可完成整个过程。

#安装并使用 extrepo

Debian Stable 下直接用如下命令安装 extrepo 即可:

sudo apt update
sudo apt install extrepo -y

接着我们就可以启用比如 Docker CE 的仓库源:

sudo extrepo enable docker-ce

然后更新系统并安装 Docker:

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y

此时我们会发现在 /etc/apt/sources.list.d 目录中多了一个 extrepo_docker-ce.sources 文件:

# cat /etc/apt/sources.list.d/extrepo_docker-ce.sources 
Suites: trixie
Types: deb
Uris: https://download.docker.com/linux/debian
Components: stable
Architectures: amd64 arm64 armhf s390x ppc64el
Signed-By: /var/lib/extrepo/keys/docker-ce.asc

换句话说,extrepo 帮我们完成了以下工作:

  1. 抓取经过验证的 GPG Key
  2. 使用 DEB822 格式写入 APT 配置

对比之前的几种方法,你可能还需要满大街找配置命令,找脚本命令,现在只要敲几行命令就可以搞定,何乐而不为呢?

看到这里读者可能有疑问,extrepo 的数据又是谁维护的呢?它是由 Debian External Repositories Team 维护,成员主要为志愿者(包括本文作者),数据本身也有个仓库叫做 extrepo-data

我个人维护了一些仓库,包括 RedisMariaDBN.WTF 等,你可以从这里看到我的 commits

任何人都可以对这个 Git 仓库做出贡献,而且 YAML 语法也十分容易上手,你可以参考默认的模板文件

需要查看完整的第三方软件源列表的话,你可以在这里浏览所有的第三方仓库的 .yaml 文件。

了解了 extrepo 的机制和优势后,我们再来总结一下。

#结论

总之,使用 extrepo 是一种既安全又方便的添加第三方软件源的方法。

它的主要优点在于:

  1. 可以让你快速启用经过测试和验证的软件源,而无需手动搜索和复制第三方软件源的配置信息。
  2. 当第三方仓库的 GPG 密钥过期或 URI 发生变化(这种情况相当常见)时,也不再需要手动更新。

比如,使用 extrepo 时,只需运行 extrepo enable docker-ceextrepo update docker-ce,它就会自动刷新 Docker CE 仓库的 GPG 密钥和 URI。

不过,extrepo 也有一定的缺点:

  1. 目前只兼容 Debian 系统,Ubuntu 因为没有人维护 extrepo-data 所以基本没有可以用的第三方软件源。
  2. 默认的 extrepo-data 托管在 Debian 官方的 GitLab Pages,这对一些网络不通畅的服务器来说获取仓库信息就有点困难,而自建 extrepo-data 的过程相对繁琐,并不算方便。

That will save a lot of time

English Version