How to Install Ubuntu on Windows 10

The desire to leverage the power and flexibility of Linux, specifically Ubuntu, while retaining the familiar Windows 10 environment is a common aspiration for developers, IT professionals, and technology enthusiasts. Fortunately, Microsoft has made this integration remarkably seamless through the Windows Subsystem for Linux (WSL). This powerful feature allows you to run a GNU/Linux environment, including Ubuntu, directly on Windows without the need for a traditional virtual machine or dual-boot setup. This eliminates the overhead of a separate operating system and provides a fluid, integrated experience for running Linux command-line tools, utilities, and applications.

Understanding the Windows Subsystem for Linux (WSL)

The Windows Subsystem for Linux, initially introduced in 2016, has evolved significantly, with WSL 2 representing a major architectural shift. While WSL 1 translated Linux system calls into Windows calls, WSL 2 utilizes a lightweight utility virtual machine (VM) running a real Linux kernel. This approach offers vastly improved system call compatibility, performance, and full system call support, making it ideal for running Docker, Node.js, and various development tools that were previously challenging or impossible on WSL 1. For the purpose of installing Ubuntu, both versions are viable, but WSL 2 is generally recommended for its superior performance and compatibility.

WSL 1 vs. WSL 2: A Crucial Distinction

Choosing between WSL 1 and WSL 2 is an important preliminary decision. WSL 1 offers a more direct translation layer, which can be beneficial for certain I/O-intensive applications where direct access to the Windows file system is paramount. However, its compatibility with Linux system calls is limited. WSL 2, on the other hand, provides a full Linux kernel, leading to near-native performance for most Linux workloads and much broader application compatibility. For most users seeking to run Ubuntu and its associated development tools, WSL 2 is the preferred and more robust option. The installation process will guide you towards enabling WSL 2 by default.

Prerequisites for Installation

Before embarking on the installation journey, ensure your Windows 10 system meets the necessary requirements. Primarily, you’ll need a 64-bit version of Windows 10. For WSL 2, a minimum of Windows 10 version 1903 with Build 18362 is required. For earlier versions of Windows 10, you might need to update your system. It’s also highly recommended to have an internet connection available throughout the process, as several components will be downloaded. Enabling virtualization in your system’s BIOS/UEFI is also a prerequisite for WSL 2, though most modern systems have this enabled by default.

Installing Ubuntu via the Microsoft Store

The most straightforward and recommended method for installing Ubuntu on Windows 10 is through the Microsoft Store. This approach automates much of the setup process and ensures you are installing a well-supported and up-to-date version of Ubuntu.

Step 1: Enabling the Windows Subsystem for Linux

The first step is to enable the WSL feature on your Windows 10 system. This can be done through either the graphical interface or the command line.

Enabling WSL via PowerShell (Recommended)

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

  2. Run the Enable Command: Type the following command and press Enter:

    wsl --install
    

    This single command will enable the necessary optional components, download the latest Linux kernel, set WSL 2 as your default, and install Ubuntu. If you are on an older version of Windows 10 and this command doesn’t work, you might need to manually enable WSL and install the kernel update first.

Manual Enabling (for older Windows 10 versions or troubleshooting)

If wsl --install doesn’t work, you can manually enable WSL and install the kernel update:

  1. Enable WSL Feature: Open PowerShell as Administrator and run:
    powershell
    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
  2. Enable Virtual Machine Platform Feature: Run this command in the same PowerShell window:
    powershell
    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  3. Restart Your Computer: After enabling these features, it’s crucial to restart your computer for the changes to take effect.
  4. Download and Install the Linux Kernel Update Package: Visit the official Microsoft documentation for WSL 2 to download the latest kernel update package for x64 machines. Run the downloaded installer and follow the on-screen prompts.
  5. Set WSL 2 as Default: Open PowerShell as Administrator and run:
    powershell
    wsl --set-default-version 2

Step 2: Installing Ubuntu from the Microsoft Store

Once WSL is enabled and configured (preferably for WSL 2), you can proceed to 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 search bar, type “Ubuntu” and press Enter. You will see various Ubuntu versions (e.g., Ubuntu 20.04 LTS, Ubuntu 22.04 LTS). It’s generally recommended to install the Long Term Support (LTS) versions for stability.
  3. Select and Install: Choose the Ubuntu version you wish to install and click the “Get” or “Install” button. The download and installation process will begin.

Step 3: Initial Ubuntu Setup

After the installation is complete, you will find Ubuntu in your Start Menu. Launching it for the first time will initiate a setup process that can take a few minutes.

  1. Launch Ubuntu: Click on the Ubuntu application icon from your Start Menu.
  2. Create a UNIX Username and Password: You will be prompted to create a username and password for your Ubuntu environment. This username and password are independent of your Windows credentials. Choose a strong password, as you will need it for administrative tasks (using sudo).
  3. Welcome to Ubuntu: Once the setup is complete, you will be greeted with the Ubuntu command-line interface, ready for your commands.

Accessing and Managing Your Ubuntu Environment

With Ubuntu installed, you can now interact with it seamlessly from your Windows 10 system.

Launching Ubuntu and Interacting with the Terminal

You can launch Ubuntu by searching for it in the Start Menu, just like any other Windows application. Upon launching, you’ll be presented with a Bash shell, which is the default command-line interpreter in Ubuntu. This is where you’ll execute Linux commands.

Integrating with Windows File Explorer

One of the significant advantages of WSL is its integration with Windows File Explorer. You can access your Windows files from within Ubuntu and, conversely, access your Ubuntu file system from Windows.

Accessing Windows Files from Ubuntu

Your Windows drives are automatically mounted under /mnt/. For example, your C: drive will be available at /mnt/c/. You can navigate to these directories using standard Linux commands:

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

Accessing Ubuntu Files from Windows

To access your Ubuntu file system from Windows File Explorer, you can simply type \wsl$ in the File Explorer address bar and press Enter. This will display a list of your installed Linux distributions, allowing you to browse their file systems directly. This is incredibly useful for transferring files or accessing configurations.

Updating and Upgrading Ubuntu Packages

It’s crucial to keep your Ubuntu installation up-to-date to ensure security and access to the latest software.

  1. Update Package Lists:

    sudo apt update
    

    This command fetches the latest information about available packages from the repositories.

  2. Upgrade Installed Packages:
    bash
    sudo apt upgrade

    This command installs the newer versions of all packages currently installed on your system. You will be prompted to confirm the upgrade, usually by typing Y and pressing Enter.

Installing New Software

The apt package manager makes installing new software in Ubuntu straightforward. You can install a vast array of applications and development tools. For example, to install git:

sudo apt install git

You can search for available packages using:

apt search <package-name>

Advanced Configurations and Use Cases

The integration of Ubuntu with Windows 10 opens up a world of possibilities for developers and power users.

Running Graphical Applications

While WSL was initially command-line focused, WSLg (Windows Subsystem for Linux GUI) now enables you to run graphical Linux applications directly on Windows without a separate X server. This feature is typically enabled by default on newer Windows 11 installations and can be enabled on Windows 10 as well. If wsl --install was used, graphical support is usually included. To run a graphical application, simply install it using apt and then execute its command in the Ubuntu terminal. For example, to install and run xeyes:

sudo apt install x11-apps
xeyes

Docker Desktop Integration

For developers working with containerization, WSL 2 provides a significantly improved experience for Docker Desktop. Docker Desktop can be configured to use the WSL 2 backend, which offers better performance and seamless integration with your Linux tools. This allows you to build, run, and manage Docker containers directly from your Ubuntu environment within Windows.

Development Workflows

Ubuntu on WSL is an excellent environment for various development tasks, including:

  • Web Development: Running Node.js, Python, Ruby, PHP servers, and associated tools.
  • Data Science: Utilizing Python libraries like NumPy, Pandas, and Scikit-learn, along with R.
  • DevOps: Employing tools like Docker, Kubernetes, Ansible, and Terraform.
  • Programming: Compiling and running code written in C, C++, Java, Go, and more.

The ability to use Linux-specific tools and environments directly within Windows streamlines development workflows and reduces the friction often associated with cross-platform development.

Troubleshooting Common Issues

While the installation is generally smooth, occasional issues might arise.

  • “WSL 2 requires an update to its kernel component.”: This usually means you need to run the manual kernel update step mentioned earlier, or wsl --update might resolve it.
  • “The virtual machine platform is not enabled.”: Ensure that the Virtual Machine Platform feature is enabled in Windows Features, and that virtualization is enabled in your BIOS/UEFI.
  • Performance Issues: If you experience slow performance, double-check that you are using WSL 2, as it generally offers superior speed. Ensure your system has adequate RAM and CPU resources.

By following these steps, you can successfully install and leverage the power of Ubuntu within your Windows 10 environment, opening up a new realm of possibilities for productivity and development.

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