Running Linux applications directly on Windows starts with enabling the Windows Subsystem for Linux feature. This guide will show you exactly how to enable Windows Subsystem for Linux on your machine, step by step.
WSL lets you run a full Linux distribution inside Windows without dual-booting or using a virtual machine. It is a game-changer for developers and IT professionals who need Linux tools.
You can use the command line, run scripts, and even use GUI apps once WSL is set up. The process is straightforward, and this article covers every method available.
Prerequisites For Enabling WSL
Before you start, check that your system meets the requirements. You need Windows 10 version 2004 or higher, or Windows 11. Older versions might work but with limitations.
Your PC must support virtualization. This is usually enabled in the BIOS or UEFI settings. Most modern computers have this turned on by default.
You also need administrator access to your Windows machine. Some steps require elevated privileges.
How To Enable Windows Subsystem For Linux
There are three main ways to enable WSL. The easiest is using a single command in PowerShell or Command Prompt. The other methods involve the Windows Features dialog or the Microsoft Store.
Choose the method that fits your comfort level. All methods lead to the same result.
Method 1: Using PowerShell Or Command Prompt
This is the fastest method. Open PowerShell or Command Prompt as an administrator. Right-click the Start button and select “Windows PowerShell (Admin)” or “Command Prompt (Admin)”.
Type the following command and press Enter:
wsl --install
This command does two things at once. It enables the Windows Subsystem for Linux feature and installs the default Linux distribution, which is Ubuntu. The process takes a few minutes.
After the installation completes, restart your computer. You will see a prompt to set up your Linux username and password the next time you open WSL.
If you want a specific distribution, use this command instead:
wsl --install -d
Replace wsl --list --online.
Method 2: Using Windows Features
Open the Control Panel and go to “Programs”. Click “Turn Windows features on or off”.
Scroll down the list until you see “Windows Subsystem for Linux”. Check the box next to it. Also check “Virtual Machine Platform” if you want WSL 2.
Click OK and wait for Windows to apply the changes. You will be prompted to restart your computer.
After the restart, open the Microsoft Store and search for a Linux distribution like Ubuntu. Install it, then launch it from the Start menu to complete the setup.
Method 3: Using The Microsoft Store
This method is for installing a specific distribution after enabling WSL. First, enable WSL using either Method 1 or Method 2.
Open the Microsoft Store and search for “Linux”. You will see several distributions. Pick one like Ubuntu, Debian, or Fedora.
Click “Get” or “Install”. The download is usually quick. Once installed, click “Launch” from the Store or find the app in your Start menu.
The first launch will take a moment to set up. You will create a Linux user account and password. This account is separate from your Windows account.
Setting WSL 2 As The Default Version
WSL 2 offers better performance and full system call compatibility. It uses a lightweight virtual machine. Most users should use WSL 2.
To check your current version, open PowerShell and type:
wsl --status
If it shows WSL 1, you can upgrade. First, ensure the Virtual Machine Platform feature is enabled. You can do this from the Windows Features dialog or with this command:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Then set WSL 2 as the default with:
wsl --set-default-version 2
If you already have a distribution installed, convert it to WSL 2 with:
wsl --set-version
Replace
Common Issues And Fixes
Some users run into problems during installation. Here are the most common ones and how to solve them.
Virtualization Not Enabled
If you get an error about virtualization, you need to enable it in your BIOS/UEFI. Restart your computer and press the key to enter setup (usually F2, F10, Del, or Esc).
Look for a setting called “Intel Virtualization Technology”, “AMD SVM”, or “Virtualization”. Enable it and save changes. Boot back into Windows and try again.
WSL Installation Fails With Error 0X80070003
This error usually means Windows cannot find the installation files. Make sure your Windows is up to date. Go to Settings > Update & Security > Windows Update and install all pending updates.
If the problem persists, try enabling WSL manually via Windows Features first, then install a distribution from the Store.
WSL Command Not Recognized
If typing wsl in the terminal gives an error, the feature might not be enabled. Run the wsl --install command again as administrator. Restart your computer afterward.
On very old Windows versions, you might need to install a separate update package. Check Microsoft’s documentation for your specific build.
Using WSL After Installation
Once WSL is enabled and you have a distribution installed, you can start using it. Open the Linux app from the Start menu, or type wsl in PowerShell or Command Prompt.
You will see a Linux terminal. You can run commands like ls, cd, and sudo apt update. Your Windows files are accessible under /mnt/c/.
To install software, use the package manager for your distribution. For Ubuntu, use sudo apt install . For Debian, it is the same. For Fedora, use sudo dnf install .
You can also run Windows executables from within WSL by typing their full path, like /mnt/c/Windows/System32/notepad.exe.
Managing Multiple Distributions
You can install more than one Linux distribution on the same Windows machine. Each one runs independently.
To list all installed distributions, use:
wsl --list
To set a default distribution for the wsl command, use:
wsl --set-default
To uninstall a distribution, go to Settings > Apps > Apps & features, find the distribution, and uninstall it. Or use wsl --unregister to remove it completely.
Updating WSL
Microsoft releases updates for WSL. To update the WSL kernel and components, run this command in PowerShell as administrator:
wsl --update
You can check for updates manually with wsl --update --check. Keeping WSL updated ensures you have the latest features and bug fixes.
Frequently Asked Questions
What Is The Difference Between WSL 1 And WSL 2?
WSL 1 translates Linux system calls to Windows ones, which is faster for file operations. WSL 2 uses a real Linux kernel in a virtual machine, offering better compatibility and performance for most tasks. WSL 2 is recommended for most users.
Can I Run GUI Applications In WSL?
Yes, with WSL 2 and Windows 11 or Windows 10 with updated drivers, you can run Linux GUI apps. Install a GUI app like gedit or firefox and launch it from the terminal. It will appear as a regular Windows window.
Do I Need To Enable Windows Subsystem For Linux Every Time I Restart?
No. Once you enable the feature, it stays on. You only need to enable it once. The Linux distribution you install will also persist across reboots.
How Do I Access Windows Files From WSL?
Your Windows drives are mounted under /mnt/. For example, your C: drive is at /mnt/c/. You can navigate there using cd /mnt/c and work with files directly.
Can I Run Docker In WSL?
Yes, Docker Desktop can integrate with WSL 2. This allows you to run Docker containers natively on Windows using the Linux kernel. It is a popular setup for developers.
Final Tips For A Smooth Experience
Keep your Windows updated. Microsoft often improves WSL with new builds. Check for updates regularly.
Use the wsl --help command to see all available options. It is a powerful tool for managing your Linux environments.
If you run into trouble, the official Microsoft documentation is excellent. Also, community forums like Stack Overflow have answers to most common questions.
Enabling WSL opens up a world of possibilities. You can use Linux tools, write scripts, and develop software without leaving Windows. It is a must-have for anyone working with cross-platform technologies.
Now you know how to enable Windows Subsystem for Linux. Go ahead and try it. The process is simple, and the benefits are huge.