loading...
Cover image for Windows 10 WSL Ubuntu 18.04 proxy configuration for apt.

Windows 10 WSL Ubuntu 18.04 proxy configuration for apt.

david_j_eddy profile image David J Eddy ・2 min read

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.

Discussion

pic
Editor guide
Collapse
pojntfx profile image
Felix Pojtinger

Use GNU/Linux

Collapse
david_j_eddy profile image
David J Eddy Author

Sadly in the business world 95%+ of computing machines will run Windows; VMs are a valid option but with bare bones hardware it would be un-usable. WSL is a nice middle ground.

Collapse
pojntfx profile image
Felix Pojtinger

It's proprietary, non-free and just ... objectivly speaking bad (unlike macOS, for example). Also, I would argue that the PC is rapidly becoming a niche product (at least for my generation) and since all smartphones run either FreeBSD/Darwin (iOS) or Linux (Android) with a PWA compatible browser, the primary platform to develop for definitely isn't Windows, but the web, and as for servers it's GNU/Linux for sure since a long time now, and LDK (Linux - Docker - Kubernetes) is the future for sure. In addition to that, doing anything else than primitive bash scripting isn't possible in WSL (which doesn't have anything to do with Linux, but GNU - thus the correct name should be GNU/NT) and thus the system is obsolete. Especially since using GNU/Linux/FreeBSD/Darwin is so easy now there really is no reason to use that legacy proprietary blob that literally preinstalls Candy Crush in 2018.

Thread Thread
david_j_eddy profile image
David J Eddy Author

I do not disagree with you. :)

Thread Thread
pojntfx profile image
Felix Pojtinger

Oh, I'm sorry if I was sounding to harsh, I forgot to put a </rant> there ;)

Thread Thread
vipseixas profile image
Vinicius Seixas

I agree with your rant but WSL is not as useless as you say. I work at a place where I have no option but use Win so I use WSL for multiple purposes and it works perfectly well for most of it. For instance, I'm just installing an ActiveMQ server in WSL. And I also use VS Code Remote with WSL wich is awesome.

Thread Thread
coderookie1994 profile image
Sharthak Ghosh

VS Code Remote changes everything. So many things possible now

Collapse
mcauto profile image
Mincheol Kim

Now, WSL2 is awesome!

Collapse
dailymack profile image
Collapse
emprint profile image
Emprint

Thanks!