Ubuntu – acquire::http::proxy for only specified repositories

aptnetworkingPROXYrepository

Is there a way to use acquire::http::proxy for some repositories?

I'm in a network that has a proxy server. So everybody has to update /etc/apt/apt.conf adding the lines like

Acquire::http::Proxy "http://yourproxyaddress:proxyport";
Acquire::https::Proxy "http://yourproxyaddress:proxyport";
Acquire::ftp::Proxy "http://yourproxyaddress:proxyport";
Acquire::socks::Proxy "http://yourproxyaddress:proxyport";

Everything working ok with that.

But now we have a LOT of ubuntu machines and I want to do a local ubuntu mirror.

So we should erase those proxy lines…. except for external repositories.

So, how do I configure something like that?

In RH based distros you can have a global proxy setting for yum and then use individual proxy settings for each repository. But didn't found something similar un Ubuntu.

Best Answer

Finally I got it working as I wanted.

For every local mirror you have to add a line like this:

Acquire::http::proxy::local.mirror.address "DIRECT";

So, in /etc/apt/apt.conf I got something like:

Acquire::http::Proxy "http://yourproxyaddress:proxyport";
Acquire::http::proxy::local.mirror.address "DIRECT";
Acquire::https::Proxy "http://yourproxyaddress:proxyport";
Acquire::ftp::Proxy "http://yourproxyaddress:proxyport";
Acquire::socks::Proxy "http://yourproxyaddress:proxyport";

That way I can use our web proxy for outside/external repositories and be able to use our local repository mirror without a web proxy.

Related Question