我已經創建了一個本地 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
這只是@塞德里克·朱利安的答案(感謝和)預設為外部代理的附加語法:
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 ---===