Ditching Linux for WSL 2
Tags: linux, windows, ubuntu, tutorial
Published: 2021-11-20 14:10:28

# WSL 2 == Microsoft's love for Linux

## Development on Linux 

I switched to Linux last year and shifted my development completely to the Linux ecosystem. Tried out arch, Manjaro, Pop OS!, Ubuntu, MX Linux. Development is really productive with a Linux environment.

## Gaming on Windows

A few months back I upgraded my *potato* to a gaming laptop which of course came with Windows pre-installed, I also started gaming. I ended up doing dual boot to run Ubuntu as my daily driver for development, but this eventually meant a redundant set of tools on Windows as well.

## Windows 💖 Linux

Windows released the Windows Subsystem for Linux 2 in May 2019. WSL 1 was a compatibility layer for running Linux binary executables on Windows. WSL2 built on top is built on the core technology of Hyper-V to provide better support and improved performance running a Linux kernel.

## Why WSL 2 instead of native Windows

Most production environments run on Linux and with WSL 2 environment the tooling available on development become the same as in production. Also WSL 2 is super easy to set up and get started with.

## Set up WSL 2 on Windows

Open an elevated Powershell (Run as administrator) from the start menu and use the following commands to get WSL 2 up and running.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1620997262601/15-pKC9Sg.png)
(*Note that: WSL 2 is only available in Windows 10, Version 1903, Build 18362 or higher*)

Step 1 - Enable the Windows Subsystem for Linux
```bash
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
```

Step 2 - Enable the Virtual Machine feature
```bash
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
```

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1620997360284/rpTUjA7tp.png)
*You need to restart your PC after this step.*

Step 3 - Download & install the Linux kernel update package
```bash
https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
```

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1620997461686/pCLXEc5hA.png)

Step 4 - As a final step set WSL 2 as your default version
```bash
wsl --set-default-version 2
```

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1620997519844/YS75xW9gL.png)

Now you can install your favourite Linux distro from the [Microsoft Store](https://www.microsoft.com/en-in/search?q=linux). After the installation completes you'll need to restart and complete the setup of your Distro.

Enter the username and password for root user and you are good to go.

![ubuntuinstall.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1620997604504/qjTozpTJj.png)

Set your default Linux distro for WSL 2.
```bash
wsl --set-version <distribution name> <versionNumber>
```

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1620997746604/xhiLRY7Pi.png)

🎉🎉🎉That's it you have successfully set up WSL 2 and can now begin your journey to become a 10x Developer.


Feel free to reach out to me on Twitter [@cryptus_neoxys](https://twitter.com/cryptus_neoxys) and connect with me on [LinkedIn](https://www.linkedin.com/in/cryptus-neoxys/).

---

### Refs & Resources

[Microsoft Docs](https://docs.microsoft.com/en-us/windows/wsl/install-win10)

[Ubuntu Wiki](https://wiki.ubuntu.com/WSL)

[ITProTV -YouTube](https://youtu.be/D7Em1wjMiak)