Amitav Roy

Blog on web and travel

Trying out Microsoft Windows WSL 2 and a quick review

Posted on 18th July, 2020 by Amitav Roy

So, I read about this new feature on Twitter not sure who made that tweet or was it a sponsored one. But I saw that Microsoft has release Windows Subsystem for Linux (WSL) version 2. Now, I was not even aware version 1 existed (I guess I was too outdated in the windows world) but this news caught my attention. Windows and Linux in the same tweet. Well, that’s interesting I thought and started reading about the feature.

So, what is this new WSL?

Microsoft’s WSL is a way for you to install a Linux environment on your Windows machine. So, now many would say – well what’s so new about it. We have VM Ware which allows us to do that. We can even use the open source version Virtual Box and install a Linux OS inside a Windows machine. However, the interesting thing about WSL is that the filesystem is integrated with your Windows system.

WSL Filesystem

By that, I mean you can have your Node or PHP project inside a Linux system. And, when you run “code .” from inside your Linux console, the folder will open up inside Visual Studio Code. Or, even right click and open that folder inside PHP Storm of VS Code (see screenshot below)

Windows Applications available inside WSL

Yes, it’s real. I do a lot of PHP development and most of it is using Laravel. And, I never liked the idea of having WAMP or XAMP to control my LAMP stack. And, that was one big reason I never used Windows as my primary OS for development. However, with this I get the best of both worlds. I am able to execute my code from inside the Ubuntu environment staying within a Windows environment. Using the Windows terminal, I am able to run all Linux commands required inside any unix based system, upgrading of PHP and other stuff can be done using the APT package manager.

The port mapping is seamless, so when you go to http://localhost, you will get the familiar Apache welcome page. If you run “php artisan server” inside Linux, you will be able to see the Laravel welcome page on http://localhost:8000 and that goes true for all other services and ports.

Some issues that I have faced

However, there are some open issues which I am already aware of:

  1. The clock has some issue and hence, my mysql service doesn’t start automatically. It showed some error during installation (however everything works fine). Just, that when I start my machine, I go and run sudo service start mysql. (Looking for a fix for the same as of now)

  2. The file system on Windows and Linux are different. So, if you reference any file from Windows inside Linux, folder permissions can be a problem. Like, I have a lot of ssh .pem files which are stored inside my Dropbox folder so that I don’t loose them. Now, if I create a symlink of the Dropbox folder from the Windows file system into the Linux machine, the “File is too open” permission issue comes up. And, you can’t fix that.

Other than that, I am overall very happy. My desktop (which is my primary development machine) is running on Windows 10 instead of Linux and I think I will continue to use it because things can only get better from here. And this does mean, I may not have to spend a huge amount on a new Mac Book Pro as my primary development environment and upgrades will not be so costly.

Tell me what do you think about this new feature. You can get in touch with me on my twitter handle @amitavroy7


Amitav Roy replied on 22nd November 2021
Oh yes, that was so easy. Thanks, yes I was facing this issue. And, I will use this. Also, I think instead of this in .zshrc or such file, I will add this in my CRON at reboot. <a class="u-mention" href=""></a> <a class="u-mention" href=""></a>
Evgeny Romanov replied on 22nd November 2021
Hey, great article, thank you! I noticed your comment about auto-starting MySQL in it. In case you still need to solve this problem, this is what I use for MySQL (and a bunch of other services). <a class="u-mention" href=""></a> <a class="u-mention" href=""></a> <a class="u-mention" href=""></a>
Ryan replied on 22nd November 2021
Thanks! Your article helped. I'm going to give this a try. I'm currently using Laragon, so if you find it easy to switch, that's good news! <a class="u-mention" href=""></a> <a class="u-mention" href=""></a> <a class="u-mention" href=""></a>
Ryan liked on 22nd November 2021
SATYAJIT GHOSH  on 22nd November 2021
Tanzim Ibthesam replied on 21st November 2021
Awesome now its like go with either windows or mac though learning linux can help <a class="u-mention" href=""></a> <a class="u-mention" href=""></a>
Bhushan Gaikwad liked on 21st November 2021
SATYAJIT GHOSH  on 21st November 2021
Zubair Mohsin liked on 21st November 2021
Dave Negrotto liked on 14th November 2021
Klaus Agnoletti liked on 14th November 2021
Mukaila Owolabi liked on 14th November 2021
Andrew Erwin liked on 14th November 2021
SATYAJIT GHOSH on 5th September 2021
Jared liked on 26th January 2021
Amitav Roy replied on 19th January 2021
Yes, I now get the best of both the worlds. Thinking to buy a Windows Laptop next when I purchase a new one. <a class="u-mention" href=""></a>
Tanzim Ibthesam replied on 19th January 2021
Awesome can't wait to use WSL2 install everything from CLI like linux <a class="u-mention" href=""></a> <a class="u-mention" href=""></a>
Neeraj Tangariya liked on 19th January 2021
JustAnotherNetworkGuy liked on 3rd September 2020
Pratham 👨‍💻✨ liked on 2nd September 2020
Rich Klein liked on 6th August 2020
Rich Klein replied on 6th August 2020
Thanks for the article, it was very helpful. I beta tested WSL 2 a while back and it had some issues with accessing servers on local ports, glad to see it was resolved. I'm hoping Laravel Valet for Linux works on WSL 2 since I like the convenience of Valet on Mac. <a class="u-mention" href=""></a> <a class="u-mention" href=""></a> <a class="u-mention" href=""></a>
Егор Русин liked on 20th July 2020
Olarry liked on 20th July 2020
Neil Ferguson liked on 20th July 2020