How to install WSL2 on Windows
Jan 03, 2024Introduction
Wonder how you can have Linux running on your Windows laptop or computer? This blog will explain step by step how to install Windows Subsystem for Linux (WSL), what it is and why you should use it.
What is WSL (Windows Subsystem for Linux)?
WSL2 is a new version of the WSL architecture. WSL allows developer/engineers to run a Linux environment without the need for a separate virtual machine or purchasing a Linux server. This enables you to keep your Windows GUI and run Linux side by side.
What problem does WSL solve?
Previously Windows did not have a feature to allow users to run Linux command lines easily on a Windows laptop. This is a problem for engineers looking to have both Windows OS and ability to run Linux command line along side that. With the release of WSL and currently WSL2, Windows users can use their computer to run Linux operating system.
How to Install WSL2
First, enable the windows subsystem for Linux
option in settings.
- Go to Start. Search for "Turn Windows features on or off"
- Check the option Windows Subsystem for Linux if it is not already and click OK.
Open your command prompt and provide the installation commands.
- Open Command Prompt as an administrator.
- Run the command below:
wsl --install
Once the installation is complete, Ubuntu will be installed by default, however you can install any distrubition of your choice.
You will need to reboot your Windows computer.
After installation, you will be prompted to enter your username and password.
Fantastic, you should have Ubuntu on your Windows machine. You can launch it by searching for Ubuntu from the start menu.
How to Install a specific Linux Distribution?
Although Ubuntu is installed by default, you can find the available list of distribution by running the below command on the Windows command prompt:
wsl --list --online
To install a specific distribution, use the command below:
wsl --install -d DISTRIBUTION-NAME
For example, to install Kali-Linux, the command would be modified as follows:
wsl --install -d kali-linux
How to check the version and status of your Linux distributions?
Open Windows PowerShell as administrator and run the command below:
wsl -l -v
Optional
You can also install Windows Terminal, WT is a multi-tabbed terminal emulator created by Microsoft for Windows 10 and higher. This is preconfigured to run Command Prompt and other shells like PowerShell, bash etc. You can refer to Microsoft documentation on how to install this.
Conclusion
WSL serves as an excellent tool for running Linux on a Windows machine natively. It provides a valuable learning environment, particularly for those who are new to this experience.
Don't miss a beat!
New moves, motivation, and classes delivered to your inbox.
We hate SPAM. We will never sell your information, for any reason.