禁用一个 apt 存储库的代理服务器

禁用一个 apt 存储库的代理服务器

我已经创建了一个本地 apt 存储库,但我的 IT 部门在代理服务器上缓存了 LAN 流量。有没有办法可以解决这个问题,以禁用此本地 apt 存储库的代理设置?在 apt.conf 中还是类似?

答案1

只需在文件中声明/etc/apt/apt.conf.d/99proxy如下内容:

Acquire::http::Proxy {
    your.local.first.repository DIRECT;
    your.second.first.repository DIRECT;
};

DIRECT告诉 apt 使用直接连接来连接到存储库。

答案2

这只是@Cédric Julien的回答(感谢)以及默认使用外部代理的附加语法:

Acquire::http::Proxy "http://proxy:8080";
Acquire::http::Proxy {
    in-house.debian.example.com DIRECT;
    no-protocol-colon-or-slashes.example.com DIRECT;
};

答案3

怎么又是一篇11年前的帖子,不过我发现了它,我的代码的一个特点是

https://github.com/hastmu/apt-proxy-detect

实际上是跳过一些存储库(例如本地存储库)的非工作代理。

享受。

本地仓库(被阻止的仓库)的检测过程被删减

[        INFO][   1]: ===--- apt-proxy-detect ---===
[    TEST-URL][  16]: URL:  http://local-repo.fritz.box/local-repo/dists/trunk/InRelease
[        HASH][  24]: HASH: 2bfbb1335aaf9d333a5c9498226eb208 of (http://local-repo.fritz.box)
[       CACHE][  29]: using stored under: /var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt
[       CHECK][  31]: once working proxy: http://192.168.0.27:8000 for http://local-repo.fritz.box/local-repo/dists/trunk/InRelease
# once working proxy failed
[ CHECK-PROXY][  41]: Proxy (http://192.168.0.27:8000) failed with testurl (http://local-repo.fritz.box/local-repo/dists/trunk/InRelease)
# search again
[       AVAHI][  46]: get cache entries for _apt_proxy._tcp
[       CHECK][  91]: Checking found proxy (http://192.168.0.27:8000) with testurl (http://local-repo.fritz.box/local-repo/dists/trunk/InRelease)
[ CHECK-PROXY][ 101]: Proxy (http://192.168.0.27:8000) failed with testurl (http://local-repo.fritz.box/local-repo/dists/trunk/InRelease)
Service[ER][Squid deb proxy on squid-deb-proxy]@http://192.168.0.27:8000 
[       CHECK][ 124]: Checking found proxy (http://192.168.0.27:3142) with testurl (http://local-repo.fritz.box/local-repo/dists/trunk/InRelease)
[ CHECK-PROXY][ 134]: Proxy (http://192.168.0.27:3142) failed with testurl (http://local-repo.fritz.box/local-repo/dists/trunk/InRelease)
Service[ER][apt-cacher-ng proxy on squid-deb-proxy]@http://192.168.0.27:3142 
# none found (as local repos are not allowed on the proxies)
[       PROXY][ 149]: return ::
[       CACHE][ 152]: Store (NONE) in cache file (/var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt)
[       CACHE][ 154]: Update cachefile.
[        INFO][   2]: ===--- apt-proxy-detect ---===

相关内容