Windows 10 WSL Ubuntu 18.04 proxy configuration for apt.

David J Eddy - Nov 15 '18 - - Dev Community

Using Windows Subsystem for Linux (WSL) can be a great tool for dev's, op's, and admin's alike. The downside often these roles are after larger organization that gave Firewalls and tight proxy security.

I found myself in this exact situation. The corp. proxy uses a *.pac file script. Nothing in the Debian world does. Ugg. Here is how I got Debian apt to work behind a proxy.

Original Solution Source from the Linux Questions Forums.

wget http://some.domain.tld/some-proxy.pac

...or you can probably just open it with a browser.

Look for the proxy address that is used if all other options fail. Typically towards the bottom / in a function call of its own.

    function FindProxyForURL(url, host) { return "PROXY proxy.foo.com:8080; DIRECT"; }

Take note of the URL:PORT address.

Finally, put this in your /etc/apt/apt.conf file:

    Acquire::http::Proxy "http://proxy.foo.com:8080";

Log out and back in. At this point apt-get update -y and related apt commands should work as expected.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .