11

In my workplace we use the Pac file for proxy network .And the Pac file when i give to the browser setting its work fine Edit-->Advance-->Network-->Setting. When i gave the Url its working fine for me.

But for apt-get i was not able to update.

I added the same URL in the network proxy for that. My pac file have no username or password.

Please suggest me .How should the apt-get work in my new ubuntu 11.10.I am really struggling a lot to fix this issue

1 Answer 1

8

I do not know if APT is able to use a PAC file directly but you can (with quite a bit of work/understanding) extract the relevant proxy information from the PAC file itself and use this information to configure APT to use a HTTP proxy.

The PAC file essentially consists of a JavaScript function. The return statement (one or more) of the function returns the proxy server address and port, for example:

return "PROXY proxy.some.site:8080; DIRECT";

Just look at your PAC file by entering its address in a browser. With this information you can create an APT configuration file:

sudo gedit /etc/apt/apt.conf.d/proxy

You should modify the file so that it contains the following information:

Acquire::http::Proxy "http://proxy.some.site:8080";

Save the file and the next apt-get run should use the configured proxy setting.

It would be nice if APT could work with PAC files because we also use them in our company. Perhaps somebody else knows if/how it works...

The Ubuntu Wiki Page for AptGet also has some hints how to configure a proxy for APT.

See also https://superuser.com/questions/323488/ubuntu-system-wide-proxy-auto-configuration-pac-script

2
  • 2
    FWIW - I had issues getting apt to work behind our MS ISA proxy. I'd tried the bash.rc method; didn't work. But creating the /etc/apt/apt.conf.d/proxy file and adding an entry in the format Acquire::http::Proxy "domain\username:password@proxy_name:8080"; did the trick.
    – Chris
    Feb 21, 2012 at 14:08
  • In my case, sudo gedit /etc/apt/apt.conf and add the line above works.
    – WesternGun
    Sep 13, 2016 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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