Windows Subsystem for Linux (WSL) is an optional feature in Windows 10 that allows developers and system administrators to run Linux shells and command-line applications without installing Linux in a virtual machine (VM). WSL provides developers with an integrated experience so they can develop and test Linux apps without ever leaving their Windows desktop. For example, you can open a Linux shell in Windows Terminal or use Visual Studio Code to build, debug, and run Linux code without installing Linux in a VM.
WSL 2 uses a new architecture to provide the benefits of WSL 1 but with better performance and compatibility. WSL 2 uses a full Linux kernel, which is kept up-to-date automatically by Microsoft, to provide full system call compatibility and fast disk performance. WSL 2 runs your chosen Linux distribution in a lightweight managed VM, which doesn’t require any configuration or management on your part.
For more information on how to run Linux GUI apps using WSL, check out How to Install Linux GUI Apps in Windows 10 and Windows 11 with WSL on Petri.
Microsoft recommends using WSL 2 unless your Linux project files must be stored in the Windows file system, or you need access to a serial port or USB device, or you need to restrict the memory usage of your Linux distribution on Windows. WSL 2 is available in Windows 10 version 1903 (build 18362) or higher (x64) or Windows for ARM version 2004 or higher (ARM64). It’s worth noting that at the time of writing, Windows Server doesn’t support WSL 2, you’ll need to use original WSL distributions.
There’s a simplified WSL 2 install procedure coming to Windows 10 in the 21H2 update, which is due in the second half of 2021. But for now, you’ll need to perform several steps to get WSL 2 running in Windows 10.
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Now that the WSL and Virtual Machine Platform features are installed, download and run the Linux kernel update package. Download the latest x64 version of the package here. ARM64 users can get the package here. Run the installer and follow through the simple steps to install it. You might be required to give consent or provide an administrator username and password to complete the setup process.
Now set WSL 2 as the default version. This will ensure you are using WSL 2 when you install your first Linux distro.
wsl --set-default-version 2
Now we’re set to install Ubuntu in WSL. You can install a Linux distribution using wsl.exe or from the Microsoft Store. Let’s check out how to install Ubuntu from the Store.
If you need to launch the Ubuntu command console again, you’ll find Ubuntu in the list of apps on the Windows Start menu. You can also access the Ubuntu shell using Windows Terminal.
Yes, you can install Ubuntu on Windows 11 with WSL 2, and the process is actually simpler. Windows 11 comes with a streamlined installation process – just open PowerShell and run ‘wsl –install -d Ubuntu’, which automatically handles all prerequisites and Ubuntu installation in one command.
You’ll receive specific error messages related to virtualization, BIOS settings, or Windows build version. The installation will fail, and you’ll need to ensure your system meets the requirements, including having virtualization enabled in BIOS and running a compatible Windows version.
After you install Ubuntu, you can access Windows files from Ubuntu through the /mnt/c directory, and Ubuntu files from Windows through \\wsl$\Ubuntu in File Explorer. You can also use VSCode’s remote WSL extension for seamless file management between both systems.
Yes, you can install multiple Ubuntu versions. Each instance will run independently with its own file system and configurations, but you’ll need to manage them using different distribution names through WSL commands.