If you are a web developer, and you are working on windows. I'm sure you have a tons of complains like I do. Important tools not having an official windows support, node-gyp build issue, no php-pcntl extension, WAMP, well you know the others if you've ever worked on them. But if you do complain about it people would simply say, "Well, just switch to linux?".
Sadly, you don't always have that option to switch. For example my current and previous company does not allow linux or mac os. For reasons from "windows is what everyone is more used to and we want everyone to be more consistent" to "our company security and monitoring tools only works on windows". And I know this scenario also happens to a lot of other people out there.
So, development on windows has brought a lot of headaches until, microsoft released Windows Subsystem for Linux a.k.a WSL.
"The Windows Subsystem for Linux lets developers run GNU/Linux environment -- including most command-line tools, utilities, and applications -- directly on Windows, unmodified, without the overhead of a virtual machine."
- Definition from windows doc about wsl
If you are a web developer, preferring or having to work on a windows machine, WSL is a must, why? Because,
- You can pick the linux distribution of your choice, and since most web servers are linux based, you will get the closest development environment as your production environment that you can get (excluding virtualization options)
- Since WSL is not a virtual environment, it is much faster compared to the virtualization environment, i.e virtualbox, docker, wmware.
- It is much easier to set up your tools like python, php, composer, node, ruby, nginx, apache, etc in an isolated environment and not having to add path to everything manually on windows anymore.
- Most tools that would work in linux will work on wsl without much issue.
But of course, WSL is not perfect. It is a great step forward but it is not a complete solution. The WSL kernel interface translates Linux system calls into windows system calls. So a lot of low level system tools would require a full linux kernel to run. For example all services needs to be started manually, which can be a hassle. Another more specific example would be issues with nginx fastcgi_buffering.
What I can say is, WSL is a blessing for web developers, or maybe even other types of developer who needs linux's tooling but is working on a windows machine. And the upcoming WSL2, with a full linux kernel support, will make it even much better, and I am really looking forward to that release :)
To end my post, here is how one would install WSL on their windows 10 machine.
- Run powershell as an admin and run
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
- Restart your computer after the script finishes running.
- Go to Microsoft Store and search for your favorite linux distribution.
- Click on 'GET' and wait for it to dowload.
- Once the download is done, click on Launch, and that's it! Congralulation you may now use linux apps on your windows pc.