如何防止 apt update 检查特定组件?

如何防止 apt update 检查特定组件?

我有时会遇到包含许多组件的存储库,或者至少我认为它们是这么称呼的。例如,包含 Insomnia 的存储库。当我在添加此存储库后运行 apt update 时,apt update 会检查很多不同的组件,其中大多数甚至都没有命中。

有什么办法可以阻止 apt update 包含这些组件吗?我在下面提供了 apt update 输出的缩短版本。

$ sudo apt update                              
Hit:1 http://deb.debian.org/debian bullseye InRelease
Hit:2 http://deb.debian.org/debian bullseye-updates InRelease                  
Hit:3 http://security.debian.org/debian-security bullseye-security InRelease   
Hit:4 http://deb.debian.org/debian buster-backports InRelease                  
Ign:14 https://download.konghq.com/insomnia-ubuntu default InRelease           
Ign:16 https://download.konghq.com/insomnia-ubuntu default Release
Ign:17 https://download.konghq.com/insomnia-ubuntu default/all all Packages
Ign:18 https://download.konghq.com/insomnia-ubuntu default/all amd64 Packages
Ign:19 https://download.konghq.com/insomnia-ubuntu default/all Translation-en_US
Ign:20 https://download.konghq.com/insomnia-ubuntu default/all Translation-en
Ign:21 https://download.konghq.com/insomnia-ubuntu default/all amd64 DEP-11 Metadata

答案1

有多种方法可以做到这一点;在这种情况下,限制更改范围的最佳方法是指定特定存储库只应更新其包索引。

要进行设置,请编辑相应的sources.list条目(在 中/etc/apt/sources.list,或在 中的文件中/etc/apt/sources.list.d),使其以

deb [target=Packages]

完成后,apt将不再从该存储库检索任何其他索引。

相关内容