HomeWinBuzzer TipsHow to Install Windows Subsystem for Linux (WSL) on Windows 11

How to Install Windows Subsystem for Linux (WSL) on Windows 11

We show you how to install and update Windows Subsystem for Linux (WSL) on Windows 11 with the latest kernel and the Linux distribution of your choice.

-

Windows Subsystem for Linux (WSL) is a powerful feature in Windows 11 that allows users to run Linux distributions directly on their Windows machine without the need for a virtual machine. By enabling WSL, you can easily install and use popular Linux distributions like Ubuntu, Debian, and Kali Linux alongside your Windows environment. This integration is particularly useful for developers, IT professionals, and anyone interested in Linux without fully committing to a dual-boot system.

In this tutorial, we will walk you through various methods to install and update WSL on Windows 11. Whether you prefer using the Command Prompt (CMD) for a more hands-on approach or the Microsoft Store for a simpler installation process, this guide has you covered. Additionally, we will show you how to keep your WSL installation updated to the latest Linux kernel version, ensuring optimal performance and security.

This guide will help you seamlessly integrate Linux into your Windows 11 setup, whether for development, learning, or exploring open-source software.

How to Install WSL on Windows 11 via Command Prompt (CMD)

This method involves using the Command Prompt (CMD) to install WSL on your Windows 11 machine. This approach is ideal for users who are comfortable with command-line interfaces and want more control over the installation process.

  1. Open an Elevated Command Prompt
     
    To begin the installation, you need to open an elevated Command Prompt. Open the Start menu and run “Command Prompt” as an administrator. This will ensure you have the necessary permissions to install WSL.
     
    Windows 11 - Open Elevated Cmd Prompt
  2. Install WSL Using CMD
     
    Once the Command Prompt is open, type the following command: wsl --install

    and press Enter. This command will download and install the latest version of WSL along with the default Linux distribution, which should be Ubuntu.
     
    Windows 11 - Elevated Cmd Prompt - Enter Install Cmd

  3. Complete the Installation
     
    After the installation is complete, you will see a prompt asking you to restart your computer. Restart your machine to finalize the WSL installation. Once your system reboots, WSL will be fully installed and ready to use. On the first start, WSL will ask you to set a username and password.
     
    Windows 11 - Linux Installation

How to Update WSL on Windows 11 to the Newest Kernel via Command Prompt (CMD)

Keeping your WSL installation updated is crucial for maintaining the latest features, performance improvements, and security patches. This method will guide you through updating WSL to the newest Linux kernel version using CMD.

  1. Open an Elevated Command Prompt
     
    Open the Start menu and run “Command Prompt” as an administrator. This will ensure you have the necessary permissions to update WSL.
     
    Windows 11 - Open Elevated Cmd Prompt
  2. Update WSL Kernel
     
    In the Command Prompt, enter the command: wsl --update and press Enter. This command will check for the latest WSL kernel and install any available updates automatically.
     
    Windows 11 - Elevated Cmd Prompt - Enter Update Cmd

How to Install WSL with Ubuntu, Debian, Kali Linux, SUSE Linux or Other Distros on Windows 11 via CMD

This method allows you to install a specific Linux distribution of your choice using the Command Prompt. Whether you prefer Ubuntu, Debian, or any other supported Linux distro, this method will help you set it up on your Windows 11 machine.

  1. Open an Elevated Command Prompt
     
    Begin by opening an elevated Command Prompt as previously described.
     
    Windows 11 - Open Elevated Cmd Prompt
  2. List Available Linux Distributions
     
    To view all available Linux distributions, type the following command: wsl --list --online and press Enter. This will display a list of Linux distributions that can be installed via WSL.
     
    Windows 11 - Elevated Cmd Prompt - Enter List Cmd Prompt
  3. Install the Selected Distribution
     
    Choose your desired Linux distribution from the list and install it by typing: wsl --install -d <DistroName> (replace <DistroName> with the name of your chosen distribution). Press Enter to begin the installation process.
     
    Windows 11 - Elevated Cmd Prompt - Enter List Cmd Prompt - Enter Distro WSL
  4. Complete the Installation
     
    After the installation completes, restart your machine if prompted. Your selected Linux distribution will now be ready to use on Windows 11. Once your system rebooted, WSL will be fully installed and ready to use. On the first start, WSL will ask you to set a username and password.
     
    Windows 11 - Debian Installation

How to Install WSL Distros on Windows 11 Using the Microsoft Store

If you who prefer a graphical interface, the Microsoft Store offers a simple way to install WSL and your preferred Linux distribution. This requires a previous step.

  1. Turn On Windows Features
     
    First, enable the necessary Windows features for WSL by opening the “Turn Windows features on or off” dialog from the Control Panel.
     
    Windows 11 - Open Turn Windows Features On or Off
  2. Activate Required Features for WSL
     
    Check the boxes for “Windows Subsystem for Linux” and “Virtual Machine Platform“, then click “OK” and restart your computer if prompted.
     
    Windows 11 - Turn Windows Features On or Off - Check Virtual Machine Platform - Accept
  3. Open the Microsoft Store
     
    After restarting, open the Microsoft Store from the Start menu.
     
    Windows 11 - Open Microsoft Store
  4. Search for Linux Distributions
     
    In the Microsoft Store, search for the Linux distribution you wish to install (e.g., Ubuntu, Debian, Kali Linux). Select the distribution and click on “Install“.
     
    Windows 11 - Microsoft Store - Debian - Install

FAQ – Frequently Asked Questions About WSL (Windows Subsystem for Linux)

Can I use GUI applications with WSL on Windows 11?

Yes, with the introduction of WSLg (Windows Subsystem for Linux GUI), you can run Linux GUI applications on Windows 11. To enable GUI app support, ensure you have WSL 2 and the latest updates installed. No additional X server or configuration is needed since WSLg integrates a Wayland, X server, pulse audio, and everything else you need directly.

What is the difference between WSL 1 and WSL 2? Which one should I use?

WSL 1 operates by translating Linux system calls to Windows OS calls, which offers fast file system performance but limited kernel compatibility. WSL 2, however, uses a real Linux kernel in a lightweight VM, providing full system call compatibility and improved performance with Linux-specific tasks. Opt for WSL 2 for a more authentic Linux experience, unless your work requires better integration with Windows tools and filesystem performance where WSL 1 is preferable.

How do I access files on Windows from a Linux distro installed via WSL?

Inside any Linux distribution on WSL, you can access files on your Windows system by navigating to the /mnt/ directory followed by the designated drive letter. For example, your C drive is accessible at /mnt/c/. This path allows you to work seamlessly with files across your Windows and Linux environments.

Can I run multiple Linux distributions with WSL?

Absolutely. WSL supports installing multiple Linux distributions from the Microsoft Store or via command line. Each installed distribution operates independently, and you can switch between them, assign one as the default, or run several simultaneously depending on your needs.

What should I do if wsl –install fails?

If installation fails, first ensure you are executing the command in an elevated (administrator) Command Prompt or PowerShell window. Verify that your Windows 10/11 version supports WSL and that virtualization is enabled in your system’s BIOS. Check your internet connection for any disruptions and consult the detailed WSL installation error messages for specific issues to troubleshoot.

How do I back up my WSL settings and data?

To back up your WSL environment, use the wsl –export <DistroName> <FilePath.tar> command to create a tarball of your distribution. Store this file in a safe location. You can restore or move your environment to another system with wsl –import <DistroName> <InstallationPath> <FilePath.tar>, setting up a new instance with all your configurations and data.

How often are WSL kernel updates released?

WSL kernel updates are not scheduled regularly but are released in response to the upstream Linux kernel updates, significant bug fixes, or security improvements. Keep your Windows updated to receive these updates automatically or manually trigger an update using wsl –update in PowerShell or Command Prompt.

How can I switch the version of a Linux distribution from WSL 1 to WSL 2?

To upgrade a Linux distro from WSL 1 to WSL 2, use the command wsl –set-version <DistroName> 2. This process might take some time depending on the size of your distribution. Your data will remain intact, but it’s always a good practice to back up important data beforehand.

How do I manage different versions of Python inside WSL?

Within WSL, you can manage multiple Python versions by using version management tools like pyenv. Install pyenv following the usual Linux instructions, then use it to install, manage, and switch between multiple Python environments, enhancing the development work on your projects.

Can I automate tasks in WSL using scripts?

Yes, WSL supports all types of Linux scripting including bash scripts. You can automate tasks by writing scripts just as you would on a native Linux system, which you can execute from within WSL. Additionally, these scripts can be scheduled using cron or triggered using bash commands from Windows Task Scheduler.

What are the best practices for using WSL for development?

To optimize your development experience on WSL: ensure your files are in the same filesystem as your development tools (preferably on the Linux filesystem for performance), utilize Git for version control, regular backups, and consider integrating your development environment with Windows-native editors/IDEs that support WSL, such as Visual Studio Code.

Is internet access required to install or use WSL?

Internet access is required during the initial installation of WSL and when downloading Linux distributions. Once installed and setup, internet access isn’t necessary to use WSL unless your activities within Linux require it (e.g., software updates, package installations).

How can I improve the performance of Linux apps running in WSL?

For optimal performance, use WSL 2, allocate enough memory and CPU cores through your system settings, and place your project files within the Linux filesystem to minimize cross-system file access delays. Regularly update your WSL to ensure you have the latest performance enhancements and bug fixes.

Can I access network services running on WSL from other devices?

Yes, services running inside WSL can be accessed externally. Configure the Windows Firewall to allow incoming connections to the service and use the IP address of the host machine. Note that WSL assigns a separate IP for internal access, so ensure networking between Windows and WSL is correctly set up.

How do I uninstall a Linux distro from WSL?

To completely remove a Linux distribution from WSL, execute the command wsl –unregister <DistroName>, which deletes all data, settings, and software within that distribution. If you wish to reinstall it later, you’ll need to do so as a fresh installation.

Related: How to Open a File or Folder in Terminal in Windows 11

Navigating the Windows Terminal to open files and folders is a skill that enhances productivity and efficiency, particularly for those who prefer command-line interfaces (CLI) over graphical user interfaces (GUI). Windows Terminal, a modern application in Windows 11, integrates traditional command-line environments like Command Prompt (CMD) and PowerShell, providing a robust platform for performing a variety of tasks. In our other guide, we show you how to open a file or folder in Command Prompt or PowerShell and how to change directory from there in Windows 11 using a series of commands.
 
Featured - How to Open a File Folder in Command Prompt Windows 11

Related: How to Open Command Prompt with the “Open Command Window Here” in File Explorer

When you want to open CMD in a folder you have to navigate there manually via commands. If you’re a heavy CMD user, this gets frustrating pretty quickly. In our other guide, we show you how to return the “open command window here” entry to your File Explorer.
 
How to return the 'Open command window here' option to Windows 10's context menu

Related: How to Disable “Show More Options” in Windows 11 to See the Full Context Menu

The “Show More Options” line in the Windows 11 context menu is a departure from the traditional, instantly accessible full menu that users have become accustomed to in previous versions of Windows. While visually appealing, this change can disrupt the workflow by adding an extra step to access commonly used functions. In our other guide, we show you how to restore the classic context menu in Windows 11, removing the need to click “Show More Options”.
 
Featured - How to Disable Show more options to always show full context menu in Windows 11

Last Updated on November 7, 2024 3:02 pm CET

Markus Kasanmascheff
Markus Kasanmascheff
Markus has been covering the tech industry for more than 15 years. He is holding a Master´s degree in International Economics and is the founder and managing editor of Winbuzzer.com.

Recent News

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Table of Contents:
Mastodon