WSL stands short for “Windows Subsystem for Linux”. It allows you to run a Linux environment directly on Windows, where you can use all command-line tools you know from Linux. In this step-by-step guide, I want to show you how you can set up a Linux environment on Windows 10. Show
Since mid-2020, the new WSL version 2 is available, which represents a fundamental revision of the underlying architecture and enables better performance and speed. Table of Contents
Prerequisites for WSL 2You can check your OS Buildand System Typeby going to Settings > System > About
If you have everything set up for WSL 2 (Virtual Machine feature enabled and Linux kernel update) and already a Linux distribution installed with WSL 1, you can go to step 8, where I show you how you can change the assigned version. Enabling WSL 2Before running WSL 2 we have to enable WSL 1 first (if you already have set up WSL 1 you can go to step 2). 1. Enable WSLOpen your PowerShell as an Administrator and run this command (you can find this command here in the official docs): 2. Check if virtualization is enabledTo enable the virtual machine feature (in step 3), your machine will require virtualization capabilities. You can check this in your Task Manager. In your CPU overview you can see if virtualization is enabled. Performance > CPU (in Task Manager)If it is not enabled, you have to change your settings in the BIOS. You can easily start into your BIOS with the Advanced Startup feature (if you already have it enabled, you can skip here and go to step 3). Go to Settings > Update & Security > Recovery and click Restart now under Advanced Startup. Windows will now restart into a recovery environment. When being in recovery, you have to click Troubleshoot and then Advanced Options. The third screen you see will look like this: Third screen after clicking Troubleshoot > Advanced OptionsSelect UEFI Firmware Settings and your machine will boot into the BIOS. The BIOS looks different depending on your motherboard manufacturer. You can check where to find the CPU settings
by looking on your manufacturer’s homepage (common manufacturers are Asus, MSI, ASRock, Intel, …). You can get information about your motherboard by running this command in PowerShell: The CPU settings can probably be found under Processor, Chipset or Northbridge. After enabling virtualization, you can save and reboot. 3. Enable Virtual Machine featureBefore installing WSL 2 you have to enable this feature. Open PowerShell as Administrator and run (this command can be found here in the official docs): dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart4. Restart machineAfter running both commands, you have to restart your machine to complete the WSL install and update to WSL 2. 5. Download the Linux kernel update packageIf you don’t know which architecture you have, you can check it in your settings (see instruction above under “Prerequisites for WSL 2”).
After downloading it, don’t forget to install it 😄 6. Set WSL 2 as default versionOpen PowerShell and run this command: wsl --set-default-version 27. Install a Linux distributionYou can search for a Linux distribution in the Microsoft Store. You can also install more than one distro and switch between them. I would recommend installing Ubuntu, as the publisher Canonical worked together with Microsoft to develop WSL. Open Microsoft Store: Ubuntu When you first start Ubuntu, you will be asked to create a user and a password. If you want, you can just type in the credentials you already use on your Windows login. Now you have everything set up and installed 🎉 8. (Optional) Check WSL version assigned to Linux distributionsWith the command wsl -l -v in the PowerShell you can list all your Linux distros and check the version. The output looks like this: If you have everything set up for WSL 2 (Virtual Machine feature enabled and Linux kernel update) and a distro is still on version 1 you can easily update it with following command: wsl --set-version <distribution name> <versionNumber>So for example: wsl --set-version Ubuntu 2 Windows then automatically updates the assigned WSL version. Here you can find out more about WSL: How do you enable Virtualization is enabled in the BIOS?How to enable Intel Virtualization Technology in BIOS?. Turn on the computer.. Press F2 while the VAIO Logo appears during boot up.. In the BIOS page, go to Advanced tab by pressing the right arrow key.. In the Advanced Tab, users will be able to see the Intel Virtualization Technology option. ... . Press Enter.. How do I enable Virtualization in Windows features?Enable the Hyper-V role through Settings. Right click on the Windows button and select 'Apps and Features'.. Select Programs and Features on the right under related settings.. Select Turn Windows Features on or off.. Select Hyper-V and click OK.. How do I enable Virtualization on a virtual machine?Enabling Hardware Virtualization. Reboot your Computer and Press the BIOS Key. ... . Locate the section for CPU configuration. ... . Find the Settings for Virtualization. ... . Select the Option for Enabling Virtualization. ... . Save the Changes You Have Made. ... . Exit Your BIOS and Reboot Your Computer.. How do I enable Virtualization in BIOS for WSL2?Enabling WSL 2. Enable WSL. ... . Check if virtualization is enabled. ... . Enable Virtual Machine feature. ... . Restart machine. ... . Download the Linux kernel update package. ... . Set WSL 2 as default version. ... . Install a Linux distribution. ... . (Optional) Check WSL version assigned to Linux distributions.. |