For many developers, system administrators, and tech enthusiasts, the versatility of Linux is indispensable. The good news is that it’s possible to use Linux within your Windows 11 environment without having to dual boot or use a separate machine. This blog post will guide you on how to enable and use Windows Subsystem for Linux (WSL), a compatibility layer used to run Linux binary executables natively on Windows.
Step 1: Enable the Windows Subsystem for Linux
The first step is to enable the WSL feature on your Windows 11 computer.
Method 1: Through PowerShell
Open a PowerShell console as Administrator and run the following command:
This command will automatically enable the necessary optional features, install a Linux distribution (Ubuntu by default), and set WSL 2 as the default version.
Method 2: Through Windows Features
Alternatively, you can enable it manually by opening Windows Features. To do this, press the Win+X keys and then select ‘Apps and Features’. Scroll down to ‘Related settings’ and click on ‘Programs and Features’. Then click on ‘Turn Windows features on or off’ and check the box next to “Windows Subsystem for Linux”. After that, click ‘OK’, and then ‘Restart Now’ to apply the changes.
Step 2: Install a Linux Distribution
After enabling WSL, the next step is to install a Linux distribution. Microsoft Store offers several distributions such as Ubuntu, Debian, and Kali Linux. Open the Microsoft Store, search for your preferred Linux distribution, and click on ‘Install’.
Step 3: Set Up Your Linux Environment
Once the Linux distribution is installed, you can launch it from the Start Menu. On the first launch, a console window will open, and you’ll be prompted to enter a new UNIX username and password. This credential will be used for the sudo command and doesn’t have to be the same as your Windows login.
Step 4: Update Your Linux System
Now that your Linux subsystem is installed and configured, it’s a good habit to update it regularly. In Ubuntu, you can do this with the following command:
sudo apt update && sudo apt upgrade
Step 5: Run Linux Commands
You’re now ready to run Linux commands in your Linux terminal. For instance, you can create a new directory with the mkdir command:
Congratulations on setting up your Linux environment within Windows 11! Enjoy the power and flexibility of Linux commands and applications right at your Windows desktop.
Remember, though WSL is a powerful tool, it’s not suitable for all use cases, especially those needing full system call compatibility or graphical user interface. For such scenarios, consider using a full-fledged Linux distribution via dual boot or virtual machine.
Get exploring and enjoy the new found power of Linux on your Windows 11 machine!