How to Install Ubuntu in Windows 10

The integration of Linux, specifically Ubuntu, into the Windows 10 environment has become an increasingly popular and powerful option for developers, system administrators, and technology enthusiasts. This synergy unlocks a wealth of open-source tools, robust command-line capabilities, and a stable development platform directly within the familiar Windows operating system. The primary mechanism for achieving this seamless integration is the Windows Subsystem for Linux (WSL). WSL allows you to run a GNU/Linux environment, including distributions like Ubuntu, directly on Windows, without the overhead of a traditional virtual machine or dual-boot setup. This article will guide you through the process of installing Ubuntu on Windows 10 using WSL, transforming your system into a versatile dual-environment powerhouse.

Understanding the Windows Subsystem for Linux (WSL)

Before diving into the installation process, it’s crucial to understand what WSL entails. Introduced by Microsoft, WSL is a compatibility layer that enables developers to run Linux command-line tools, utilities, and applications directly on Windows, unmodified, without the overhead of a traditional virtual machine. It achieves this by translating Linux system calls into Windows system calls. There are two major versions of WSL: WSL 1 and WSL 2.

WSL 1: The Original Compatibility Layer

WSL 1 operates by translating Linux system calls into their Windows equivalents. This means it doesn’t run a real Linux kernel. While it offers good performance for many command-line tools and applications, it has limitations when it comes to full system call compatibility, particularly for more demanding applications or those that interact directly with the kernel.

WSL 2: A Revolution in Linux Integration

WSL 2 represents a significant architectural shift. Instead of call translation, WSL 2 utilizes a lightweight virtual machine (VM) that runs a full Linux kernel, sourced directly from the Linux kernel release repository. This VM is managed by Windows and is highly optimized for performance and seamless integration. The benefits of WSL 2 are substantial:

  • Full System Call Compatibility: Running a real Linux kernel means near-perfect compatibility with Linux applications.
  • Improved File System Performance: WSL 2 offers significantly faster file I/O operations, especially for Linux file systems.
  • Complete System D-Bus Support: Essential for many Linux GUI applications.
  • Faster Startup Times: The lightweight VM boots very quickly.

For most users looking to install Ubuntu, WSL 2 is the recommended and superior option due to its enhanced compatibility and performance.

Prerequisites for Installing Ubuntu with WSL

To ensure a smooth installation, ensure your Windows 10 system meets the following requirements:

  • Windows 10 Version: You need a 64-bit version of Windows 10. For WSL 2, a recent version is recommended. Specifically, for WSL 2, you need Windows 10 version 1903 or higher, with Build 18362 or later for x64 systems, or Windows 10 version 2004 or higher, with Build 19041 or later for ARM64 systems.
  • Administrator Privileges: You will need administrator rights to install and configure WSL.
  • Virtualization Enabled: For WSL 2, hardware virtualization must be enabled in your system’s BIOS/UEFI settings. Most modern computers have this enabled by default, but it’s worth checking if you encounter issues. You can verify this by opening Task Manager (Ctrl+Shift+Esc), navigating to the “Performance” tab, and selecting “CPU.” Look for “Virtualization” on the right-hand side; it should be listed as “Enabled.”

Installing Ubuntu Using the Microsoft Store

The easiest and most straightforward method for installing Ubuntu on Windows 10 is through the Microsoft Store. This method automates much of the setup process and ensures you get the latest stable versions of both WSL and your chosen Linux distribution.

Step 1: Enable the Windows Subsystem for Linux Feature

Before you can install Ubuntu, you need to enable the WSL feature in Windows 10.

  1. Open PowerShell as Administrator: Search for “PowerShell” in the Windows search bar, right-click on “Windows PowerShell,” and select “Run as administrator.”

  2. Run the WSL Installation Command: In the administrator PowerShell window, type the following command and press Enter:

    wsl --install
    

    This single command is a modern shortcut that performs several actions:

    • Enables the necessary optional features: “Virtual Machine Platform” and “Windows Subsystem for Linux.”
    • Downloads and installs the latest Linux kernel.
    • Sets WSL 2 as the default.
    • Downloads and installs the Ubuntu distribution (by default, it installs the latest Ubuntu LTS).

    If you are on an older version of Windows 10 or prefer a more manual approach, you can enable WSL and the Virtual Machine Platform separately:

    • To enable WSL:
      powershell
      dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
    • To enable Virtual Machine Platform (required for WSL 2):
      powershell
      dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  3. Restart Your Computer: After enabling the features, you will be prompted to restart your computer to complete the installation. Do not skip this step.

Step 2: Set WSL 2 as the Default (if not done by wsl --install)

If you enabled WSL manually or used an older command, you might need to explicitly set WSL 2 as your default version. This ensures that any new Linux distributions you install will use WSL 2.

  1. Open PowerShell as Administrator.
  2. Run the Default Version Command:
    powershell
    wsl --set-default-version 2

    If this command fails, it means the WSL 2 kernel component is not installed or updated. You can download and install the latest WSL2 Linux kernel update package from Microsoft’s documentation or use the wsl --install command which handles this.

Step 3: Install Ubuntu from the Microsoft Store

With WSL enabled, you can now install Ubuntu.

  1. Open the Microsoft Store: Search for “Microsoft Store” in the Windows search bar and open it.
  2. Search for Ubuntu: In the Microsoft Store’s search bar, type “Ubuntu” and press Enter.
  3. Select Your Ubuntu Version: You will see several Ubuntu versions listed (e.g., Ubuntu, Ubuntu 20.04 LTS, Ubuntu 22.04 LTS). It is generally recommended to choose the latest LTS (Long Term Support) version for stability, such as “Ubuntu 22.04 LTS.” Click on your desired version.
  4. Click “Get” or “Install”: On the Ubuntu app page, click the “Get” or “Install” button. The download and installation process will begin. The size of the download can vary, so ensure you have a stable internet connection.

Step 4: Launch and Set Up Ubuntu

Once the installation is complete, you can launch Ubuntu for the first time.

  1. Launch Ubuntu: You can find “Ubuntu” in your Windows Start Menu, or you can search for it. Alternatively, open PowerShell or Command Prompt and type wsl and press Enter.
  2. Initial Setup: The first time you launch Ubuntu, it will perform some initial setup. This may take a few minutes. You will then be prompted to create a username and password for your Ubuntu environment.
    • Username: Choose a username (e.g., user, admin, dev). This username is specific to your Ubuntu instance and does not need to match your Windows username.
    • Password: Create a secure password. You will need this password for sudo commands within Ubuntu. Note that when you type your password, you won’t see any characters appear on the screen for security reasons. Press Enter after typing it. You will be asked to re-enter the password to confirm.

Congratulations! You have now successfully installed Ubuntu on Windows 10 using WSL. You are now in a Linux terminal, ready to explore and utilize the vast ecosystem of Linux tools.

Managing Your Ubuntu Installation

After installation, you’ll want to know how to manage your Ubuntu environment.

Updating Ubuntu

It’s crucial to keep your Ubuntu system up-to-date to benefit from the latest software, security patches, and bug fixes.

  1. Open your Ubuntu terminal (by typing wsl in PowerShell/CMD, or launching Ubuntu from the Start Menu).
  2. Update Package Lists: First, update the list of available packages from the repositories:
    bash
    sudo apt update

    Enter your Ubuntu password when prompted.
  3. Upgrade Installed Packages: After updating the lists, upgrade all installed packages to their latest versions:
    bash
    sudo apt upgrade

    You may be asked to confirm the upgrade by typing ‘Y’ and pressing Enter.

Installing New Software

You can install a wide range of software packages using the Advanced Packaging Tool (APT).

  1. Search for a Package: If you’re unsure of the exact package name, you can search for it:
    bash
    apt search <package_name_or_keyword>
  2. Install a Package: Once you know the package name, install it:
    bash
    sudo apt install <package_name>

    For example, to install the git version control system:
    bash
    sudo apt install git

Accessing Windows Files from Ubuntu

WSL 2 makes accessing your Windows files from within Ubuntu very straightforward. Your Windows drives are automatically mounted under the /mnt/ directory.

  • Your C: drive will be accessible at /mnt/c/.
  • Your D: drive will be accessible at /mnt/d/, and so on.

For example, to navigate to your Windows Documents folder, you would use:

cd /mnt/c/Users/<YourWindowsUsername>/Documents

Accessing Ubuntu Files from Windows

Accessing Ubuntu files from Windows is also supported. You can use Windows File Explorer to navigate your Linux file system.

  1. Open File Explorer.
  2. Type \wsl$ in the address bar and press Enter.
  3. You will see a folder for each Linux distribution you have installed (e.g., Ubuntu-22.04). Navigate into this folder to access your Ubuntu file system.

Advanced Configurations and Use Cases

Once you have Ubuntu running, the possibilities expand significantly, opening doors to powerful development workflows and system administration tasks.

Running Graphical Linux Applications

While WSL was initially command-line focused, with WSLg (WSL GUI), you can now run graphical Linux applications directly on Windows. This is automatically included with recent installations of WSL, especially when using wsl --install. You can install graphical applications like VS Code, Firefox, or GIMP and launch them from your Ubuntu terminal by simply typing their executable name.

Development Environments

Ubuntu on WSL is an ideal environment for web development, software engineering, and data science. You can easily install and manage:

  • Programming Languages: Python, Node.js, Ruby, Go, Java, etc.
  • Databases: PostgreSQL, MySQL, MongoDB.
  • Web Servers: Apache, Nginx.
  • Containerization Tools: Docker (requires specific setup with Docker Desktop for Windows).
  • IDEs and Editors: VS Code with its Remote – WSL extension provides an exceptional integrated development experience.

Shell Customization and Scripting

Take full advantage of Linux’s powerful shell environment. Customize your shell prompt, write shell scripts for automation, and leverage tools like grep, awk, sed, and find for sophisticated text manipulation and system management.

Connecting to Remote Servers

Use your Ubuntu WSL environment to connect to remote servers via SSH. Install your preferred SSH client, manage your keys, and conduct remote operations with ease.

Dual Booting vs. WSL

It’s worth noting the advantages WSL offers over traditional dual-booting. WSL provides a much more integrated experience, allowing you to seamlessly switch between Windows and Linux environments without rebooting. You can run Windows and Linux applications side-by-side, and file sharing is significantly simpler. While dual-booting offers full hardware access for Linux, WSL, particularly WSL 2, provides near-native performance for most common use cases, making it the preferred choice for many developers.

By following these steps, you can efficiently install and manage Ubuntu on your Windows 10 system, unlocking a powerful combination of operating systems for enhanced productivity and a broader range of technological capabilities.

Leave a Comment

Your email address will not be published. Required fields are marked *

FlyingMachineArena.org is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com. Amazon, the Amazon logo, AmazonSupply, and the AmazonSupply logo are trademarks of Amazon.com, Inc. or its affiliates. As an Amazon Associate we earn affiliate commissions from qualifying purchases.
Scroll to Top