如何在apt中代理特定的repo

ars*_*012 5 package-management apt networking proxy

我最近切换到 Ubuntu 15.10。

我需要使用代理连接到外部互联网。在我的本地互联网上,有一个不需要代理连接的存储库。

所以我在 /etc/apt/apt.conf.d/proxy 写了这样的东西

Acquire::http::Proxy::google.com "http://XXX:8087";
Acquire::http::Proxy::spotify.com "http://XXX:8087";
Run Code Online (Sandbox Code Playgroud)

不幸的是,这不起作用,apt-get update 说无法连接 google Spotify。我也试过把它改成这个。

Acquire::http::Proxy "http://XXX:8087";
Run Code Online (Sandbox Code Playgroud)

我现在可以连接到 google 和 Spotify,但我无法连接到我的本地存储库。没有更好的解决方法吗?

wie*_*oma 6

创建一个文件:/etc/apt/apt.conf.d/99proxy并在此文件中插入以下内容:

Acquire::http::Proxy {
    your.local.repository DIRECT;
};
Run Code Online (Sandbox Code Playgroud)

这告诉 apt 使用直接连接(而不是通过代理)来访问您的本地存储库。

更改your.local.repository到本地存储库的正确位置。

  • 感谢您的回复,这都是我的错,更改 'Acquire::http::Proxy::google.com "http://XXX:8087";' '获取::http::Proxy::dl.google.com“http://XXX:8087”;' 工作过 (2认同)