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.

Posted on Nov 8 '18 by:

david_j_eddy profile

David J Eddy

@david_j_eddy

AWS Certified (x4), Automated Testing / Continuous Integration / Delivery / Deployment (CI/CDs), Cloud, Containers, Dev(Sec)Ops, Software Engineer.

Discussion

markdown guide
 
 

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.

 

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.

I do not disagree with you. :)

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

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.

VS Code Remote changes everything. So many things possible now