Install Windows Subsystem for Linux (WSL)
3 min read
6 months ago
Published on Apr 22, 2024
This response is partially generated with the help of AI. It may contain inaccuracies.
Table of Contents
How to Install Windows Subsystem for Linux (WSL)
-
Check Your Operating System Version:
- Open the Start menu and search for "System Information."
- Check the OS name and version. Ensure you are running Windows 10 or Windows 11.
-
Choose a Linux Distribution:
- For beginners, Ubuntu or Linux Mint Cinnamon is recommended.
- For intermediate users, Debian 12 Bookworm is suggested.
-
Activate Windows Subsystem for Linux (WSL):
- Open the Start menu and search for "Turn Windows features on or off."
- Activate "Virtual Machine Platform" and "Windows Subsystem for Linux."
- Click "OK" and save your work. Restart your computer.
-
Install WSL:
- Open Command Prompt (CMD) by searching for it in the Start menu.
- Type
wsl --install
and press Enter. - Follow the prompts to complete the installation.
-
Update WSL:
- Use the command
wsl --update
to ensure you have the latest version. - Confirm the update by entering 'yes.'
- Use the command
-
Install a Linux Distribution:
- Check available distributions online by running
wsl --list --online
. - Choose a distribution (e.g., Ubuntu) and install it using
wsl --install -d <distribution_name>
.
- Check available distributions online by running
-
Explore the Linux Environment:
- Access the Linux environment by opening the Linux folder.
- Navigate through directories using commands like
cd <directory>
and list files withls
.
-
Access Linux through WSL App:
- Search for "WSL" in the Start menu to open the WSL app, providing access to the Linux terminal.
-
Use Windows Terminal:
- Search for "Terminal" in the Start menu to open the Windows Terminal app.
- Switch between different terminals, including Ubuntu, within the same window.
-
Verify Ubuntu Version:
- In the Ubuntu terminal, run
lsb_release -a
to confirm the Ubuntu version.
- In the Ubuntu terminal, run
-
Update Ubuntu:
- Run
sudo apt update
andsudo apt upgrade
to update Ubuntu packages.
- Run
-
Access WSL through PowerShell:
- Open PowerShell and run
wsl
to access WSL through the command line.
- Open PowerShell and run
-
Understand WSL 1 vs. WSL 2:
- WSL 1 uses a translation layer for compatibility, while WSL 2 runs a full Linux kernel for better performance.
- Check and switch to WSL 2 if needed by following Microsoft's guide.
-
Completion:
- Congratulations! You have successfully installed and set up Windows Subsystem for Linux (WSL) on your Windows machine.
Next Steps:
- In the following videos, learn about using Git, GitHub, and VS Code within your WSL environment for a seamless coding experience.