How To Install WSL2 On Windows 11: A Step-by-Step Guide
Windows Subsystem for Linux (WSL) allows you to run a Linux environment directly on Windows 11, without the need for a virtual machine or dual-booting. WSL 2 is the latest version, offering significant performance improvements over WSL 1 thanks to its use of a lightweight virtual machine. This guide provides a clear, step-by-step process for installing WSL2 on your Windows 11 machine, even if you’re a complete beginner.
By following these instructions, you’ll be able to easily set up a Linux distribution of your choice, opening up a world of development tools and environments without leaving the comfort of your Windows desktop. Let’s get started installing WSL2 on Windows 11.
How Do I Install WSL2 on Windows 11?
Step 1: Enable Virtual Machine Platform and Windows Subsystem for Linux Features
- Open the Start Menu and search for “Turn Windows features on or off”.
- Click on “Turn Windows features on or off” in the search results.
- In the “Windows Features” window, scroll down and check the boxes next to “Virtual Machine Platform” and “Windows Subsystem for Linux”.
- Click “OK”.
- Restart your computer when prompted.
Step 2: Download and Install the WSL2 Linux Kernel Update Package
- Open your web browser and go to the official Microsoft documentation page for WSL2 installation. Search for “WSL2 Linux kernel update package for x64 machines” on Bing or Google.
- Download the latest WSL2 Linux kernel update package.
- Run the downloaded installer.
- Follow the on-screen instructions to complete the installation.
Step 3: Set WSL 2 as the Default Version
- Open PowerShell as an administrator. Right-click the Start button and select “Windows Terminal (Admin)” or “PowerShell (Admin)”.
- Type the following command and press Enter:
wsl --set-default-version 2
Step 4: Install a Linux Distribution from the Microsoft Store
- Open the Microsoft Store.
- Search for your preferred Linux distribution (e.g., Ubuntu, Debian, Kali Linux).
- Click on the distribution you want to install.
- Click “Install”.
- After the download is complete, click “Open”.
Step 5: Complete the Linux Distribution Installation
- A new console window will open, and the installation process for your chosen Linux distribution will begin.
- You will be prompted to create a user account and password for your Linux environment. Choose a username and a strong password.
- Once the installation is complete, you will be logged in to your Linux environment.
Tips for Using WSL2
- File System Access: Your Windows files are accessible within the WSL2 environment under the
/mnt/cdirectory (wherecis your C: drive). Similarly, Linux files can be accessed from Windows via the network share\\wsl$\<distro_name>. - Running GUI Applications: WSL2 supports running graphical Linux applications with a little extra configuration. You’ll need to install an X server on Windows. Search for “Run Linux GUI apps on Windows with WSL” for tutorials.
- Updating WSL2: Keep your WSL2 installation up-to-date by running
sudo apt update && sudo apt upgrade(or the equivalent for your distribution) within your Linux environment. - Managing WSL2: Use the
wslcommand in PowerShell to manage your WSL2 distributions. For example,wsl --list --verbosewill show you the installed distributions and their status.
Comparing WSL 1 and WSL 2
| Feature | WSL 1 | WSL 2 |
|---|---|---|
| Architecture | Translation layer | Lightweight virtual machine |
| File System I/O | Slower | Significantly faster |
| Full Linux Kernel | No | Yes |
| System Calls | Not fully compatible | Fully compatible |
| Use Cases | Basic Linux tools and scripting | Development, running Docker, resource-intensive Linux applications |
Embracing Linux Power on Windows 11
Installing WSL2 opens up a new world of possibilities for developers and Linux enthusiasts on Windows 11. With just a few simple steps, you can have a fully functional Linux environment running alongside your favorite Windows applications.
FAQ
What is WSL2? WSL2 (Windows Subsystem for Linux 2) is a feature in Windows 11 that allows you to run a Linux environment directly on Windows without needing a virtual machine or dual-booting.
What are the advantages of WSL2 over WSL1? WSL2 offers significantly improved file system performance, a full Linux kernel, and better system call compatibility compared to WSL1.
Can I run graphical Linux applications in WSL2? Yes, you can run graphical Linux applications in WSL2 by installing an X server on Windows.
How do I access my Windows files from WSL2? Your Windows files are accessible within the WSL2 environment under the /mnt/c directory.
How do I update WSL2? You can update your Linux distribution within WSL2 using the package manager for your distribution (e.g., sudo apt update && sudo apt upgrade for Ubuntu).
Related reading
Read our disclosure page to find out how can you help MSPoweruser sustain the editorial team Read more
User forum
0 messages