DEV Community

Cover image for Getting Started With WSL (Windows Subsystem for Linux )
Ayoub Belouadah
Ayoub Belouadah

Posted on • Updated on

Getting Started With WSL (Windows Subsystem for Linux )

in this article we are going to cover the installation and the usage of WSL

WSL allows you to run a real Linux environement on windows without a virtual machine
Once you have it setup you can open the command line and start working on the file system like you are on Linux, and that's in fact on Linux and windows at the same time , you can be working on your server code on one screen while working on Adobe Photoshop on the other screen.

Note: WSL works only on windows 10

So lets get started

  • Open PowerShell as an administrator (win + x ) and run the following Commande:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Enter fullscreen mode Exit fullscreen mode
  • Install the Linux distro of your choice , go to Microsoft Store and type "Linux" to get the available distros

Microsoft store

  • Once the installation is complete , click on the launch button to initialize your distro You will be prompt to create a new user account and its password

Microsoft store

  • Update and upgrade your distro's packages
sudo apt update && sudo apt upgrade
Enter fullscreen mode Exit fullscreen mode

and that's it ! enjoy using your Linux distro on WSL , you can install all your dev tools like git, nodejs, docker and everything you need

check out the awesome tutorial from Fireship youtube channel
and the official documentation from Microsoft

Top comments (1)

Collapse
 
davelsan profile image
David Velasco • Edited

I have WSL2 setup on a Windows machine that I use daily for web development. It works very well, but I have experienced some limitations:

  • I'd have to install an X server for Electron development. I recall reading that WSL is not intended for the development of Desktop GUI applications, hence no DISPLAY.

  • I cannot run e2e tests with protractor (Angular). This can be circumvented with proper configuration, maybe using puppeteer, as with anything that requires a Chrome binary.

  • I had the same problem using Karma/Jasmine for unit testing (Angular). IIRC the solution was to either provide a CHROME_BIN variable (no need for X server, just use a Windows install in /mnt/c/...) or use puppeteer (headless).

  • Puppeteer needs special configuration. I need to investigate more use cases, but it is likely that the best scenario is to use its own Chrome executable.

Note: These are off the top of my head, from problems I've run into at some point, so the situation might have changed in the present. Once I'm on my computer (phone right now), I'll take a look again at a few related issues.

Update: BTW, I really recommend upgrading to WSL2. The changes to file system alone are worth it.