How To Enable Or Disable Windows 11 Subsystem Fit Linux On Windows 11
Windows Subsystem for Linux (WSL) is a powerful feature introduced by Microsoft, which allows users to run a GNU/Linux environment directly on Windows without the need for a virtual machine or dual booting. With WSL, you can run native Linux command-line tools, utilities, and even some graphical applications directly on Windows 11. This makes it an excellent tool for developers, system administrators, and enthusiasts who work across multiple platforms.
In this guide, we'll cover how to enable and disable WSL on Windows 11, how to install and set up Linux distributions, and how to manage WSL instances effectively.
1. What is Windows Subsystem for Linux (WSL)?
Windows Subsystem for Linux is a compatibility layer that allows you to run Linux binaries natively on Windows. Initially released with WSL 1, which translated Linux system calls to Windows equivalents, WSL 2 offers a more complete Linux kernel running in a lightweight virtual machine, giving you better performance and compatibility.
Key features of WSL include:
1.Running Linux command-line tools directly on Windows.
2.Access to a wide range of Linux software through package managers like `apt`, `yum`, or `pacman`.
3.Interoperability between Linux and Windows file systems.
4.WSL 2 includes a full Linux kernel for better performance and compatibility.
5.Ability to run graphical Linux applications (WSLg) in WSL 2.
2. Prerequisites for Enabling WSL on Windows 11
Before enabling WSL, ensure your system meets the following requirements:
1.Windows 11: WSL is supported on Windows 11 and Windows 10 (version 1903 or higher).
2.Virtualization: Virtualization must be enabled in your system's BIOS/UEFI settings. This is necessary for WSL 2, as it uses a lightweight virtual machine to run the Linux kernel.
To check if your system has virtualization enabled:
1. Press Ctrl + Shift + Esc to open the Task Manager.
2. Go to the Performance tab and look at the Virtualization status. If it’s enabled, you're good to go. If not, you’ll need to enable it in your system’s BIOS/UEFI.
3. How to Enable WSL on Windows 11
To enable Windows Subsystem for Linux, you can follow these steps:
Step 1: Open PowerShell as Administrator
1. Press Win + S to open the search bar.
2. Type PowerShell.
3. Right-click on Windows PowerShell and select Run as administrator.
Step 2: Install WSL
In PowerShell, you can install WSL using the following command:
```bash
wsl --install
```
This command does several things at once:
1.It installs the necessary components for WSL.
2.It installs WSL 2 as the default version.
3.It downloads and installs the latest Ubuntu distribution by default.
Step 3: Restart Your Computer
Once the installation is complete, you’ll be prompted to restart your computer. After restarting, WSL will be enabled, and Ubuntu will be installed.
Step 4: Install Additional Linux Distributions (Optional)
If you want to install additional Linux distributions besides Ubuntu, you can do so by going to the Microsoft Store:
1. Open the Microsoft Store from the Start menu.
2. Search for your desired Linux distribution (e.g., Debian, Fedora, Kali Linux).
3. Click Install to download and install the distribution.
Once the installation is complete, you can access the distribution by typing its name in the Start menu or running it from the command line using `wsl -d <distribution_name>`.
4. Setting WSL Version to WSL 1 or WSL 2
By default, WSL will install WSL 2. However, you can switch between WSL 1 and WSL 2 depending on your needs. WSL 2 offers better performance and compatibility but requires virtualization. WSL 1 may be preferred if you want to avoid virtualization or use specific file system features.
Step 1: Set WSL Version Globally
To set WSL 2 as the default version for all future Linux distributions:
```bash
wsl --set-default-version 2
```
Step 2: Set WSL Version for a Specific Distribution
If you have already installed a Linux distribution and want to change its version to WSL 2:
```bash
wsl --set-version <distribution_name> 2
```
For example, to change Ubuntu to WSL 2, the command would be:
```bash
wsl --set-version Ubuntu 2
```
To check which distributions are installed and their current version:
```bash
wsl --list --verbose
```
5. How to Disable WSL on Windows 11
If you no longer need WSL or want to disable it for any reason, you can easily do so by following these steps:
Step 1: Open Windows Features
1. Press Win + S and search for Turn Windows features on or off.
2. In the Windows Features window, scroll down and find Windows Subsystem for Linux.
3. Uncheck the box next to Windows Subsystem for Linux.
Step 2: Disable WSL 2 Components (Optional)
If you’ve been using WSL 2 and want to completely disable all related components, you’ll also need to disable:
1.Virtual Machine Platform: Used by WSL 2 to run the Linux kernel in a virtual machine.
2.Windows Hypervisor Platform: Provides necessary components for virtualization.
Uncheck both options in the Windows Features window if you want to disable them.
Step 3: Restart Your Computer
After disabling WSL, restart your computer to complete the process.
Step 4: Uninstall Linux Distributions (Optional)
If you want to remove installed Linux distributions, you can uninstall them like any other Windows application:
1. Open Settings > Apps > Installed apps.
2. Scroll through the list, find the Linux distributions you installed (e.g., Ubuntu), and click Uninstall.
6. Installing and Managing Linux Distributions
WSL allows you to install multiple Linux distributions and manage them independently. After enabling WSL, you can install additional distributions, switch between them, and uninstall them as needed.
Step 1: Installing Distributions from the Microsoft Store
To install additional distributions:
1. Open the Microsoft Store.
2. Search for your preferred Linux distribution (e.g., Debian, Fedora, Kali Linux).
3. Click Install and wait for the installation to complete.
Once installed, you can launch the distribution by typing its name in the Start menu or running the command `wsl -d <distribution_name>`.
Step 2: Managing Installed Distributions
You can view and manage your installed distributions using PowerShell or the Command Prompt.
1.To view a list of installed distributions:
```bash
wsl --list
```
Or to get detailed information:
```bash
wsl --list --verbose
```
2.To set a default distribution:
```bash
wsl --set-default <distribution_name>
```
3.To uninstall a distribution:
```bash
wsl --unregister <distribution_name>
```
7. Using WSL for Development
One of the main reasons for enabling WSL on Windows 11 is to develop software in a Linux environment without leaving Windows. WSL offers several tools that make it easier for developers to work on cross-platform applications.
Step 1: Accessing Linux Files from Windows
WSL allows you to access the Linux file system directly from Windows. To open your Linux file system in Windows Explorer, type the following in the address bar:
```
\\wsl$
```
This will open a network location where you can see your Linux distributions and access their files.
Step 2: Running Linux Applications
You can run Linux command-line tools like `git`, `node`, and `python` directly from your WSL terminal. Simply open a WSL session by typing `wsl` in PowerShell or the Command Prompt and start running your Linux commands.
Step 3: Using WSL for Web Development
With WSL, you can set up development environments for web applications using tools like Docker, Apache, Nginx, and more. You can also install your preferred Linux-based text editors and IDEs to work on your projects.
8. Benefits and Drawbacks of Using WSL
Benefits:
1.Cross-Platform Development: Developers can use Linux tools while still working within the Windows environment.
2.Integration: WSL integrates seamlessly with Windows, allowing you to run Linux apps and Windows apps side-by-side.
3.Low Resource Usage: Unlike a full virtual machine, WSL consumes minimal resources.
Drawbacks:
1.Not Full Linux: While WSL provides a robust Linux environment, it may lack support for certain Linux features or hardware-dependent applications.
2.Limited GUI Support: Although WSLg enables some graphical applications, it's not as fully featured as a traditional Linux GUI environment.
Conclusion
Windows Subsystem for Linux on Windows 11 is a powerful tool for anyone needing access to a Linux environment while remaining within the Windows ecosystem. Enabling or disabling WSL is a straightforward process, and once set up, you can install and manage various Linux distributions with ease. Whether you're a developer looking to leverage Linux tools or someone looking to explore Linux commands, WSL
Related Courses and Certification
Also Online IT Certification Courses & Online Technical Certificate Programs