Linux on Windows has always been a bit of a mess when trying to mimic a Unix(MacOS) experience. Cygwin has been my de facto tool of choice to be able use all my linux tools from a command line however packages don’t always all work right and may not work as expected.
There’s always the option of using a VM with the linux flavor of the month but there’s a bit of clunky-ness to it that always got in the way. Copy/Paste issues from VM to Desktop and back. Mouse focus has to be toggled off while leaving focus from the VM interface and Alt+Tab to quickly cycle through to the application you want to be focused on doesn’t work from the interface. Some of this is more true depending on which virtualization technology you’re using but I’ve worked with both Oracle VirtualBox and VMware WorkFusion and most the little annoyances are there both of them.
It is hard not to need virtualization depending on your needs, but if you’re like many of us developers, it’s nice to have a native space you can install Nginx or Apache onto and locally access via http://localhost or http://whatever.name.you.add.to/etc/hosts/file. Basically it’s your linux distro playground that will be very similar to where most applications are deployed.
Enter WSL1 and WSL2, Windows Subsystem for Linux. In their words — “The Windows Subsystem for Linux lets developers run a GNU/Linux environment — including most command-line tools, utilities, and applications — directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup.“
The process to install was real easy. The only quirk I’ve noticed so far is that I needed to add legitimate nameservers(e.g. Google’s 18.104.22.168 and 22.214.171.124) to the Ubuntu installation in order for URLs to resolve properly. The annoying thing is that I need to do it again every time I kill the terminal session to it and come back. But it’s really not that often my local development needs to reach outside of the network, I’m sure I’ll find a more permanent fix if it does. So far so good! Within a day I had a Composer initialized instance of a simple “Hello World” application using Laravel PHP framework served up by Nginx on an Ubuntu server that was all backed by the WSL2.
So far I’m a huge fan. It’s not a solution for all my linux needs, but it’s a huge step towards convenience and I’m sure it’ll only get better. They have great set of instructions here https://docs.microsoft.com/en-us/windows/wsl/install-win10 for installation on Windows and I highly recommend all devs on Windows check it out.