Ditching Linux for WSL 2

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 product…


This content originally appeared on DEV Community and was authored by Dev Sharma

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
(Note that: WSL 2 is only available in Windows 10, Version 1903, Build 18362 or higher)

Step 1 - Enable the Windows Subsystem for Linux

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Step 2 - Enable the Virtual Machine feature

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

image.png
You need to restart your PC after this step.

Step 3 - Download & install the Linux kernel update package

https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

image.png

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

wsl --set-default-version 2

image.png

Now you can install your favourite Linux distro from the Microsoft Store. 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

Set your default Linux distro for WSL 2.

wsl --set-version <distribution name> <versionNumber>

image.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 and connect with me on LinkedIn.

Refs & Resources

Microsoft Docs

Ubuntu Wiki

ITProTV -YouTube


This content originally appeared on DEV Community and was authored by Dev Sharma


Print Share Comment Cite Upload Translate Updates
APA

Dev Sharma | Sciencx (2021-11-20T14:10:28+00:00) Ditching Linux for WSL 2. Retrieved from https://www.scien.cx/2021/11/20/ditching-linux-for-wsl-2/

MLA
" » Ditching Linux for WSL 2." Dev Sharma | Sciencx - Saturday November 20, 2021, https://www.scien.cx/2021/11/20/ditching-linux-for-wsl-2/
HARVARD
Dev Sharma | Sciencx Saturday November 20, 2021 » Ditching Linux for WSL 2., viewed ,<https://www.scien.cx/2021/11/20/ditching-linux-for-wsl-2/>
VANCOUVER
Dev Sharma | Sciencx - » Ditching Linux for WSL 2. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/11/20/ditching-linux-for-wsl-2/
CHICAGO
" » Ditching Linux for WSL 2." Dev Sharma | Sciencx - Accessed . https://www.scien.cx/2021/11/20/ditching-linux-for-wsl-2/
IEEE
" » Ditching Linux for WSL 2." Dev Sharma | Sciencx [Online]. Available: https://www.scien.cx/2021/11/20/ditching-linux-for-wsl-2/. [Accessed: ]
rf:citation
» Ditching Linux for WSL 2 | Dev Sharma | Sciencx | https://www.scien.cx/2021/11/20/ditching-linux-for-wsl-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.