Step-by-Step Guide to Installing WSL 2 on Your Windows System
How to Install WSL 2
In this article, we will guide you through the process of installing Windows Subsystem for Linux 2 (WSL 2) on your Windows 10 or Windows 11 system. WSL 2 is a major update to the original WSL, offering improved performance and a more native Linux experience. Follow these steps to get started with WSL 2.
1. Check Your Windows Version
Before installing WSL 2, ensure that your Windows version is compatible. WSL 2 is available for Windows 10 version 2004 (May 2020 Update) or later, and Windows 11. To check your Windows version, type “winver” in the Windows search bar and press Enter.
2. Enable Virtual Machine Platform
WSL 2 requires the Virtual Machine Platform feature to be enabled. To do this, follow these steps:
1. Open PowerShell as Administrator by searching for “PowerShell” in the Windows search bar, right-clicking on it, and selecting “Run as administrator.”
2. Type the following command and press Enter:
“`
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
“`
3. Restart your computer if prompted.
3. Install WSL 2
Now that your system meets the requirements, you can install WSL 2. Here’s how:
1. Open PowerShell as Administrator (as described in step 2 of the previous section).
2. Type the following command and press Enter:
“`
wsl –install -d Ubuntu
“`
This command will install Ubuntu 20.04 LTS as your default Linux distribution. You can replace “Ubuntu” with any other distribution you prefer.
3. Follow the on-screen instructions to complete the installation.
4. Configure WSL 2
After the installation is complete, you may need to configure WSL 2 to ensure optimal performance. Here are a few tips:
1. Set WSL 2 as the default Linux distribution by running the following command in PowerShell as Administrator:
“`
wsl –set-default Ubuntu
“`
2. Configure your WSL 2 distribution to use a solid-state drive (SSD) for better performance. To do this, open the distribution’s settings file (e.g., `Ubuntu` in this example) using a text editor, and add the following line at the end:
“`
[virtualization]
enabled = true
“`
3. Restart your computer to apply the changes.
5. Launch WSL 2
Now that WSL 2 is installed and configured, you can launch your Linux distribution. To do this, simply type “wsl” in the Windows search bar and press Enter. You will now be able to enjoy a more native Linux experience on your Windows system.
By following these steps, you should have successfully installed WSL 2 on your Windows 10 or Windows 11 system. Happy coding!