I recently switched to Ubuntu 15.10.

I need to use a proxy to connect to external internet.And on my local internet there's a repo that doesn't require proxy to connect.

So I wrote something like this in /etc/apt/apt.conf.d/proxy

Acquire::http::Proxy::google.com "http://XXX:8087";
Acquire::http::Proxy::spotify.com "http://XXX:8087";

Unfortunately,this doesn't work, apt-get update says failed to connect google spotify. I also tried change it to this.

Acquire::http::Proxy "http://XXX:8087";

I can connect to google and spotify now, but I can't connect to my local repo. Isn't there a better workaround?

  • 1
    Are you connecting to google.com or dl.google.com or www.google.com, or some other subdomain of google.com altogether? – muru Jan 1 '16 at 18:31
  • yes, it's dl.google.com – arslan2012 Jan 2 '16 at 2:55

Create a file: /etc/apt/apt.conf.d/99proxy and in this file insert the following:

Acquire::http::Proxy {
    your.local.repository DIRECT;

This tells apt to use a direct connection (so not via proxy) to access your local repository.

Change your.local.repository to the correct location of your local repository.

| improve this answer | |
  • 1
    Thanks for your reply, it's my fault all alone,changing 'Acquire::http::Proxy::google.com "XXX:8087";' to'Acquire::http::Proxy::dl.google.com "XXX:8087";' worked – arslan2012 Jan 2 '16 at 3:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.