When you have Windows Subsystem for Linux (WSL) enabled, you can install Linux distribution apps from the Microsoft Store. Users can make WSL 1 or WSL 2 the default architecture to be used as the default Linux distribution version whenever any new Linux distributions are installed. Users can also set the Linux distribution version to WSL 1 or WSL 2 for existing installed Linux distributions at any time. In this post, we will show you how to set Linux Distribution version to WSL1 or WSL2 in Windows 11/10.
Set Linux Distribution version to WSL1 or WSL2
WSL 2 (Windows Subsystem for Linux 2) is a new version of the architecture in WSL that changes how Linux distributions interact with Windows. WSL 2 has the primary goals of increasing file system performance and adding full system call compatibility. Each Linux distribution can run as WSL 1 or as WSL 2, and can be switched between at any time. WSL 2 is a major overhaul of the underlying architecture and uses virtualization technology and a Linux kernel to enable its new features.
You can;
- Set Default Linux Distribution version to WSL 1 or WSL 2 for New Linux Distributions
- Set Linux Distribution version to WSL 1 or WSL 2 for Specific Installed Linux Distributions
Let’s take a look at the description of the process involved.
1] Set Default Linux Distribution version to WSL 1 or WSL 2 for New Linux Distributions
Do the following:
- Press Windows key + X to open Power User Menu.
- Press A on the keyboard to launch PowerShell in admin/elevated mode.
- In the PowerShell console, type in the cmdlet below, as per your requirement and hit Enter.
Set WSL 1 as default version:
wsl --set-default-version 1
OR
Set WSL 2 as default version:
wsl --set-default-version 2
2] Set Linux Distribution version to WSL 1 or WSL 2 for Specific Installed Linux Distributions
Do the following:
- Press Windows key + X to open Power User Menu.
- Then press i on the keyboard to launch PowerShell.
- In the PowerShell console, type in or copy and paste the cmdlet below and hit Enter. Make note of the Linux distribution name you want to change the version (1 or 2) for.
wsl --list --verbose
Next, type the command below into PowerShell, and hit Enter.
wsl --set-version <distribution name> <versionNumber>
Substitute the <distribution name> (eg; Ubuntu) and <versionNumber> placeholder with the actual Linux distribution name and the number 1 (WSL 1) or 2 (WSL 2) for the default version respectively from the verbose list. Your command should look something like this:
wsl --set-version Ubuntu 2
You can now exit the PowerShell console.
How do I enable WSL2 in Windows 11?
In order to enable WSL2 in Windows 11, you need to use this command: wsl –install. However, you cannot use it having a standard account. You must log into your administrator account and open the Command Prompt or Windows PowerShell with administrator privileges first. Then, you can enter the command mentioned earlier.
How do I change my distro to WSL2?
If you want to change the Linux distribution in WSL2, you can go through the steps mentioned above. First, you need to enter this command: wsl –list –verbose. Then, you can use this command to get the job done: wsl –set-version <distribution name> <versionNumber>.
That’s it on how to set Linux Distribution version to WSL1 or WSL2 in Windows 11/10!