Setting Up Windows Subsystem for Linux (WSL) in Windows 11: A Comprehensive Guide

Setting Up Windows Subsystem for Linux (WSL) in Windows 11: A Comprehensive Guide

Ian Lv13

Setting Up Windows Subsystem for Linux (WSL) in Windows 11: A Comprehensive Guide

Key Takeaways

To install the Windows Subsystem for Linux (WSL) on Windows 11, run Terminal as administrator, then enter “wsl –install” into the window. Run “wsl –install -d Distro”, replacing “Distro” with the name of a Linux distro, to install a specific distribution instead of Ubuntu. You can install additional Linux distros from the Terminal or the Microsoft Store.

The Windows Subsystem for Linux (WSL) lets you run Linux software on your Windows 11 PC. When you enable WSL, Windows will install a custom-built Linux kernel. You can then install Ubuntu or another Linux distribution of your choice.

https://techidaily.com

How WSL Works on Windows 11

You can enable the Windows Subsystem for Linux (WSL) on all editions of Windows 11 —even Windows 11 Home. (You can also install WSL on Windows 10 .)

Like more recent versions of Windows 10, Windows 11 uses WSL 2. This second version is redesigned and runs a full Linux kernel in a Hyper-V hypervisor for improved compatibility. When you enable the feature, Windows 11 downloads a Microsoft-built Linux kernel that it runs in the background. Windows Update keeps the kernel updated. (You can use your own custom Linux kernel if you prefer, too.)

To use WSL, you’ll need to install a Linux distribution. By default, WSL installs Ubuntu. This will give you access to a full Ubuntu command-line environment using the Bash shell or any other command-line shell of your choice.

You can access your Linux shell environments in the Windows Terminal app included with Windows 11, too.

You can also run graphical Linux apps out of the box (Just install them in the Linux command-line environment and run the command). Windows 11 also includes support for running Linux apps with GPU access, making GPU-accelerated Linux computing workloads run well on Windows.

It is also worth noting that most new, interesting developments for WSL are shifting to Windows 11—Windows 10 users won’t be able to use them.

Install WSL through Windows Terminal

Microsoft has made this process extremely simple on Windows 11. You can enable the Windows Subsystem for Linux and install a Linux distribution like Ubuntu with a single command.

To do this, you will need to use a command-line window with Administrator permissions. We’ll do this with the Windows Terminal, although you can also just launch Command Prompt.

To launch a Windows Terminal with Administrator permissions, right-click the Start button on the taskbar or press Windows+X and click “Terminal (Admin).” (You can also find the Windows Terminal shortcut in your Start menu—right-click it and select “Run as Administrator.”) Agree to the User Account Control prompt that appears.

Right-click the Start button, then select "Terminal (Admin)."

https://techidaily.com

To enable the Windows Subsystem for Linux and install Ubuntu, which is the default distribution, just run the following command:

wsl –install

When the process is complete, Windows will ask you to reboot your PC. Restart your computer by entering shutdown /r /t 0 into the Terminal. You’ll be able to use your Linux system after you do. (You can right-click the Start menu and click Shut Down or Sign Out > Restart to quickly reboot.)

Run the "wsl --install" command.

https://techidaily.com

To list other available Linux distributions, run the following command instead. This lists (-l) distributions that are available online (-o).

wsl -l -o

You can install a Linux distribution of your choice by running the following command, replacing “Name” with the name of the Linux distro, as displayed in the “Name” column:

wsl –install -d Name

For example, to install Debian instead of Ubuntu, you’d run:

wsl –install -d Debian

You can also run this command multiple times to install several Linux distributions on your system.

List available Linux distributions and install one.

https://techidaily.com

Once your computer has rebooted, you can launch the Linux distro that you installed from your Start menu.

Launch the "Ubuntu" shortcut.

You’ll also find it as an option in the Windows Terminal app. Click the down arrow to the right of the new tab “+” button on the tab bar and select the Linux distribution that you installed.

If you don’t see the Linux distribution that you installed in the Windows Terminal, launch it from your Start menu first. After it completes its first-run setup process, it will appear here.

Click the down arrow and select your Linux distribution.

Now, you can use the Linux shell just as if you were sitting in front of a PC Linux—or as if you were remotely connected to a server running Linux. You’ll just need to know Linux commands .

The Slow Way: Enable WSL and Install a Distro

You can also enable the Windows Subsystem for Linux (WSL) the older way. This takes more clicking, and we recommend just running the command above.

If you install a Linux distro before installing and enabling WSL you may experience problems. If this happens, run wsl -l to list your current Linux distros, then use enter the command wsl –unregister followed by the name of the distro. Try launching the Linux distro again.

To do this, open your Start menu and search for “Windows features.” (You can press the Windows key to open the Start menu and just start typing.) Launch the “Turn Windows Features On or Off” shortcut.

Enable the “Windows Subsystem for Linux” checkbox here and click “OK.” You will be prompted to reboot your computer.

Enable the "Windows Subsystem for Linux" option and click "OK."

After you do, open the Microsoft Store app and search for the Linux distribution that you want to use. For example, you might search for “Ubuntu.”

Install the Linux distribution that you want to use (like Ubuntu) as you would any other application. Just click the “Get” button on its Store page.

Search for "Ubuntu," then click "Get."

You can now launch it from your Start menu just as if it were installed from the command above.

New Linux distros are occasionally added to the Microsoft Store, and you can find the currently available distros by searching for “Linux” rather than a specific distro. If your preferred Linux flavor isn’t available, you can always import your preferred distro into WSL manually.

Also read:

  • Title: Setting Up Windows Subsystem for Linux (WSL) in Windows 11: A Comprehensive Guide
  • Author: Ian
  • Created at : 2024-11-07 03:36:22
  • Updated at : 2024-11-13 22:22:55
  • Link: https://techidaily.com/setting-up-windows-subsystem-for-linux-wsl-in-windows-11-a-comprehensive-guide/
  • License: This work is licensed under CC BY-NC-SA 4.0.