How To Install Windows Subsystem for Linux on Windows 11

The Windows Subsystem for Linux (WSL) is a powerful feature in Windows 10 and Windows 11 that allows you to run a Linux distribution directly on your Windows operating system. With WSL, you can access a Linux command-line environment and run Linux applications alongside your regular Windows programs. This guide will walk you through the steps to install WSL on your Windows 11 computer.

Prerequisites

Before you begin, make sure that your Windows 11 system meets the following requirements:

  • Your Windows 11 version is build 22000 or later. You can check your build number by going to Settings > System > About.
  • Your system supports virtualization and has virtualization enabled in the BIOS/UEFI settings. Most modern computers support this feature.
  • You have enabled the “Virtual Machine Platform” optional component in Windows. You can do this by going to Settings > Apps > Optional features > More Windows features, and then selecting “Virtual Machine Platform” and clicking “Install.”

Step 1: Enable WSL in Windows 11

  1. Open the Start menu and search for “Turn Windows features on or off.”
  2. In the “Windows Features” window, scroll down and check the box next to “Windows Subsystem for Linux.”
  3. Click “OK” to apply the changes and restart your computer if prompted.

Step 2: Install Your Preferred Linux Distribution

After enabling WSL, you can install your preferred Linux distribution from the Microsoft Store. Here’s how:

  1. Open the Microsoft Store app.
  2. Search for the Linux distribution you want to install. Some popular options include Ubuntu, Debian, Kali Linux, and openSUSE.
  3. Select the distribution you want and click “Install.”
  4. After the installation is complete, launch the distribution by searching for it in the Start menu.
See also  How to Set Adobe Acrobat Reader as the Default PDF Viewer on Windows 11 in 3 Easy Steps

The following links will open the Microsoft store page for each distribution:

Alternatively, you can install Linux distributions using the wsl --install command in PowerShell or Command Prompt. This command will install the latest version of Ubuntu by default, but you can also specify a different distribution using the --distribution flag.

Step 3: Set Up Your Linux Distribution

When you launch your Linux distribution for the first time, you’ll be prompted to create a new user account and password. Follow the on-screen instructions to complete the setup process.

Once you’re in the Linux environment, you can start using the command line and installing software just like you would on a regular Linux system.

Step 4: Configure WSL (Optional)

While WSL works well out of the box, you may want to customize some settings or enable additional features. Here are a few optional configuration steps you can take:

1. Enable GUI Applications

By default, WSL runs in a command-line environment, but you can install a graphical user interface (GUI) and run Linux desktop applications on your Windows 11 system. To do this, you’ll need to install an X server for Windows, such as VcXsrv or X410.

Starting up WSL

To start using WSL, open up a PowerShell terminal and type wsl. If you’ve set up WSL correctly, you’ll enter a bash terminal running on the WSL distro of choice. From here, you can run any Linux commands you wish.

See also  Cloud Download Vs Local Reinstall: Which is Better?

Below you will find a reference to all of the options the wsl.exe provides when starting up.

COMMANDEXPLANATIONEXAMPLE
exec, -eWill run command using without using default shellwsl -e curl google.com
Passes anything after this parameter to default shell. Leaving the operator out will also work.wsl — curl google.com, wsl curl google.com
distribution, -dOpens a terminal in the specified distribution’s shellwsl -d Ubuntu-18.04
user, -uRuns WSL command as the specified user as long as user exists on that distrowsl -d Ubuntu-18.04 -u tux_user
exportExports the specified distribution to a tar file on your local system.wsl –export Ubuntu ./Test-Ubuntu.tar
import [–version]Imports a tar file as a new WSL distribution. Can specify WSL version with the –version optionwsl –import Test-Ubuntu C:\data\Test-Ubuntu .\Test-Ubuntu.tar
list, -l [Options]wsl –list
allList all installed WSL distributionswsl -l –all
runningList only WSL distributions that are currently runningwsl -l –running
quiet, -qOnly show WSL distribution nameswsl -l -q
verbose, -vShow detailed information about all WSL distributionswsl -l -v
set-default, -sSets the specified WSL distribution as the default distribution for WSL commands.wsl -s Test-Ubuntu
set-default-versionChanges the default WSL version for all new distributions installed to that systemwsl –set-default-version 2
set-versionChanges the WSL version of the specified distributionwsl –set-version Test-Ubuntu 2
shutdownImmediately terminates all running WSL distributionswsl –shutdown
terminate, -tTerminates the specified WSL distributionwsl -t Test-Ubuntu
unregisterUnregisters the specified WSL distributionwsl –unregister Test-Ubuntu
helpDisplay information about using WSLwsl –help

Once you get comfortable using these switches, you’ll find that running and managing applications through WSL is much easier than managing Linux virtual machines on your own.

See also  5 Windows Tricks You Didn't Know About

2. Manage WSL Instances

If you have multiple Linux distributions installed, you can manage them using the wsl command in PowerShell or Command Prompt. Some useful commands include:

  • wsl --list --verbose: List all installed Linux distributions and their details.
  • wsl --set-default <DistributionName>: Set the default Linux distribution to use when running the wsl command.
  • wsl --export <DistributionName> <FileName.tar>: Export a Linux distribution to a .tar file.
  • wsl --import <DistributionName> <InstallLocation> <FileName.tar>: Import a Linux distribution from a .tar file.

3. Customize WSL Settings

You can customize various settings for WSL by editing the /etc/wsl.conf file within your Linux distribution. Some common settings you can modify include:

  • kernel: Set the Linux kernel version to use.
  • systemRoot: Set the location of the Windows system root directory.
  • swapFile: Configure a swap file for improved memory management.
  • networkingMode: Set the networking mode for your Linux distribution.

4. Access Windows Files from WSL

One of the great features of WSL is the ability to access your Windows file system from within the Linux environment. By default, your Windows drives are mounted under the /mnt/ directory in WSL. For example, your C:\ drive would be accessible at /mnt/c/.

5. Install Windows Terminal (Optional)

If you prefer a more modern and customizable command-line experience, you can install the Windows Terminal app. It supports multiple tabs, panes, and profiles, making it easier to work with WSL and other command-line tools.

References

  1. Windows Subsystem for Linux Documentation
  2. Install Windows Subsystem for Linux
  3. Manage WSL Instances
  4. Configure WSL
  5. Access Windows Files from WSL
  6. Install Windows Terminal

Conclusion

The Windows Subsystem for Linux provides a powerful way to run Linux distributions directly on your Windows 11 system. By following the steps outlined in this guide, you can install and configure WSL to suit your needs, whether you’re a developer, system administrator, or just someone who wants to explore the world of Linux. With WSL, you can take advantage of the best of both worlds – the familiarity of Windows and the power of Linux.

Did you like this article? Do not hesitate to share it on social networks and subscribe to Tech To Geek on Google News to not miss any articles!
3/5 - (2 votes)
"Because of the Google update, I, like many other blogs, lost a lot of traffic."

Join the Newsletter

Please, subscribe to get our latest content by email.

Mohamed SAKHRI

I am Mohamed SAKHRI, the creator and editor-in-chief of Tech To Geek, where I've demonstrated my passion for technology through extensive blogging. My expertise spans various operating systems, including Windows, Linux, macOS, and Android, with a focus on providing practical and valuable guides. Additionally, I delve into WordPress-related subjects. You can find more about me on my Linkedin!, Twitter!, Reddit Facebook

Leave a Comment