Installing Ubuntu on Windows with WSL

This documentation provides a step-by-step guide to installing and configuring Ubuntu on Windows using the Windows Subsystem for Linux (WSL). It covers enabling WSL, installing Ubuntu via the Microsoft Store, performing initial setup, configuring the environment, running GUI applications, and troubleshooting common issues. Perfect for students and professionals looking to integrate Linux with Windows seamlessly. 🚀
Written by teamember02
Updated 2 weeks ago

Introduction

Windows Subsystem for Linux (WSL) allows you to run a Linux environment directly on Windows without needing a virtual machine or dual-boot setup. This guide will walk you through installing and setting up Ubuntu on WSL.


Prerequisites

  • A Windows 10 (Version 2004 or later) or Windows 11 machine

  • Administrator privileges

  • Internet connection


Step 1: Enable WSL

Method 1: Using PowerShell

  1. Open PowerShell as Administrator.

  2. Run the following command to enable WSL: 

    wsl --install

    This command will:

    • Enable the WSL feature

    • Install the default Linux distribution (usually Ubuntu)

    • Set up necessary system components

  3. Restart your computer when prompted.


Method 2: Manual Installation (For Older Versions)

If the above command doesn’t work, follow these steps:

  1. Open PowerShell as Administrator.

  2. Enable the required features manually:

    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  3. Restart your computer.

  4. Install the WSL 2 Linux kernel update from Microsoft’s official website.

  5. Set WSL 2 as the default version:

    wsl --set-default-version 2

Step 2: Install Ubuntu

  1. Open Microsoft Store.

  2. Search for Ubuntu.

  3. Click Install on your preferred Ubuntu version (e.g., Ubuntu 22.04 LTS).

  4. Once installed, launch Ubuntu from the Start menu.


Troubleshooting

1. "WSL 2 requires a kernel update"

  • Download and install the WSL 2 kernel update from here.

2. "Ubuntu is not launching"

  • Try restarting WSL:

    wsl --shutdown
  • Then relaunch Ubuntu.

3. Switching to WSL 2 manually

If Ubuntu is using WSL 1, upgrade it:


Conclusion

You have successfully installed and configured Ubuntu on WSL! You can now run Linux commands, develop applications, and integrate Ubuntu seamlessly with Windows.

Did this answer your question?