How to Install Ubuntu on Windows: A Beginner's Guide to WSL

Step-by-Step Instructions to Run Ubuntu on Windows Using the Windows Subsystem for Linux (WSL)

How to Install Ubuntu on Windows: A Beginner's Guide to WSL

Are you looking to explore the world of Linux without leaving the comfort of your Windows operating system? Installing Ubuntu on Windows is a great way to experience the power and flexibility of Linux while still having access to your favorite Windows applications. Whether you're a developer, a student, or just a tech enthusiast, this guide will walk you through the process of installing Ubuntu on Windows using the Windows Subsystem for Linux (WSL).

What is WSL?

The Windows Subsystem for Linux (WSL) is a compatibility layer developed by Microsoft that allows you to run a Linux distribution, such as Ubuntu, directly on Windows. WSL provides a full-fledged Linux environment, complete with a terminal, command-line tools, and even graphical applications (with WSL 2). This makes it an excellent choice for those who want to use Linux tools and utilities without dual-booting or setting up a virtual machine.

Prerequisites

Before we dive into the installation process, make sure your system meets the following requirements:

  1. Windows 10 or Windows 11: WSL is available on Windows 10 (version 2004 and later) and Windows 11.

  2. Administrator Privileges: You’ll need administrative access to enable WSL and install Ubuntu.

  3. Internet Connection: A stable internet connection is required to download the necessary files.

Step 1: Enable the Windows Subsystem for Linux (WSL)

  1. Open PowerShell as Administrator: Right-click on the Start menu and select "Windows PowerShell (Admin)" or "Command Prompt (Admin)".

  2. Enable WSL: In the PowerShell window, type the following command and press Enter:

    powershell
    wsl --install

    This command will enable the WSL feature and install the default Linux distribution (usually Ubuntu).

    If you’re using an older version of Windows 10, you may need to enable WSL manually:

    powershell
    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
  3. Enable Virtual Machine Platform: If you’re using WSL 2 (recommended), you’ll also need to enable the Virtual Machine Platform feature:

    powershell
    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  4. Restart Your Computer: After enabling these features, restart your computer to apply the changes.

Step 2: Install Ubuntu from the Microsoft Store

  1. Open the Microsoft Store: Once your computer has restarted, open the Microsoft Store from the Start menu.

  2. Search for Ubuntu: In the search bar, type "Ubuntu" and press Enter. You’ll see several versions of Ubuntu (e.g., Ubuntu 20.04 LTS, Ubuntu 22.04 LTS). Choose the one you prefer.

  3. Install Ubuntu: Click on the "Get" or "Install" button to download and install Ubuntu. The installation process may take a few minutes, depending on your internet speed.

Step 3: Set Up Ubuntu

  1. Launch Ubuntu: After the installation is complete, you can launch Ubuntu from the Start menu. The first time you launch it, the system will take a few moments to set up.

  2. Create a User Account: You’ll be prompted to create a new UNIX username and password. This account will be used for administrative tasks within the Ubuntu environment.

  3. Update Ubuntu: Once your account is set up, it’s a good idea to update the system to ensure you have the latest packages and security patches. Run the following commands in the Ubuntu terminal:

    bash
    sudo apt update
    sudo apt upgrade

Step 4: (Optional) Upgrade to WSL 2

WSL 2 offers better performance and full system call compatibility, making it the preferred version for most users. If you’re not already using WSL 2, you can upgrade your Ubuntu installation:

  1. Check WSL Version: To check which version of WSL your Ubuntu distribution is using, run:

    powershell
    wsl --list --verbose
  2. Set WSL 2 as Default: If your Ubuntu distribution is using WSL 1, you can convert it to WSL 2 by running:

    powershell
    wsl --set-version Ubuntu 2

    Replace "Ubuntu" with the name of your distribution if it’s different.

  3. Set WSL 2 as Default for New Installations: To ensure that future installations use WSL 2 by default, run:

    powershell
    wsl --set-default-version 2

Step 5: Start Using Ubuntu on Windows

Congratulations! You’ve successfully installed Ubuntu on Windows. You can now use the Ubuntu terminal to run Linux commands, install software, and even run graphical applications (with WSL 2 and a compatible X server).

Tips for Using Ubuntu on Windows

  • Access Windows Files: You can access your Windows files from within Ubuntu by navigating to /mnt/c/ (or /mnt/d/ for the D: drive, etc.).

  • Install Additional Software: Use the apt package manager to install additional software. For example, to install Python, you can run:

    bash
    sudo apt install python3
  • Customize Your Terminal: You can customize the Ubuntu terminal by installing zsh, oh-my-zsh, or other shell enhancements.

Conclusion

Installing Ubuntu on Windows using WSL is a straightforward process that opens up a world of possibilities for developers, sysadmins, and anyone interested in Linux. With WSL, you can seamlessly switch between Windows and Linux environments, making it easier to work with cross-platform tools and applications.

Whether you’re experimenting with Linux for the first time or need a robust development environment, WSL provides the best of both worlds. So, go ahead and give it a try—you might just find that Ubuntu on Windows becomes an indispensable part of your workflow!

Happy coding!


Author Bio:
Rajesh Mondal is a tech enthusiast and software developer with a passion for exploring new technologies. When not coding, [Your Name] enjoys writing about tech, gaming, and everything in between. Follow Rajesh Mondal on Twitter/LinkedIn for more tech tips and tutorials.