I am attempting to set up WSL 2. In order to do so, I completed the following steps:
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
“Referring to the instructions at https://docs.microsoft.com/en-us/windows/wsl/wsl2-install, the following task is to enable a distro to use WSL2 instead of WSL1. This requires running the command wsl –set-version <Distro> 2. I attempted to do so, replacing <Distro> with Ubuntu, but encountered the following error message:”
Invalid command line option: --set-version
I am uncertain if WSL2 is installed on my system since I received an error message.
My operating system is Windows 10 Build 18362.356.
2 Answers
Introduction
WSL 2 is a new version of the Windows Subsystem for Linux (WSL) that was released in 2019. It is designed to be faster and more efficient than the previous version, WSL 1. WSL 2 runs a real Linux kernel in a lightweight virtual machine that provides better performance and compatibility with Linux applications.
In this blog post, we will discuss how to get WSL 2 running on your Windows 10 computer. We will cover the steps required to enable the necessary features, install a Linux distribution, and set it up to use WSL 2.
Enabling the Required Features
Before you can use WSL 2, you need to enable two Windows features: Virtual Machine Platform and Windows Subsystem for Linux.
To enable these features, open PowerShell as an administrator and run the following commands:
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
After running these commands, restart your computer to complete the installation of the features.
Installing a Linux Distribution
Once you have enabled the required features, you need to install a Linux distribution from the Microsoft Store. To do this, follow these steps:
1. Open the Microsoft Store app on your computer.
2. Search for the Linux distribution you want to install (e.g., Ubuntu, Debian, or Kali Linux).
3. Click the Install button to download and install the distribution.
After the installation is complete, you can launch the Linux distribution from the Start menu or by running the command “wsl” in PowerShell or Command Prompt.
Setting Up WSL 2
By default, the Linux distribution you installed will be set up to use WSL 1. To switch to WSL 2, you need to run the following command in PowerShell or Command Prompt:
wsl --set-version <DistributionName> 2
Replace <DistributionName>
with the name of the Linux distribution you installed (e.g., “Ubuntu” or “Debian”).
If you receive an error message that says “Invalid command line option: –set-version”, it may be because you are running an older version of Windows 10 that does not support WSL 2. Make sure you are running at least Windows 10 version 1903 (build 18362) or later.
Using WSL 2
Once you have set up your Linux distribution to use WSL 2, you can start using it like any other Linux system. You can run Linux commands in the terminal, install Linux applications using the package manager, and access files on your Windows system through the Linux file system.
WSL 2 also provides improved performance compared to WSL 1, so you should notice faster startup times and better overall performance when using Linux applications.
Conclusion
WSL 2 is a powerful tool that allows you to run Linux applications on your Windows 10 computer. With its improved performance and compatibility, it is a great option for developers and Linux enthusiasts who want to use Linux tools on Windows.
In this blog post, we covered the steps required to enable WSL 2 on your Windows 10 computer, install a Linux distribution, and set it up to use WSL 2. With these steps, you should be able to start using WSL 2 and enjoy its many benefits.
My operating system is Windows 10 Build 18362.356
“To fulfill the requirements for the task, your system must have WSL 1 installed and be on build 18917 or a later version.”
See
Invalid command line options #419
and
WSL 2 install documentation updated to include links to instructions on how to install WSL 1.