How to Install Ubuntu on Windows 10, 11
Whether you’re a developer seeking a powerful command‑line environment, a Linux enthusiast wanting to experiment with open‑source tools, or simply curious about Ubuntu, installing it on Windows via the Windows Subsystem for Linux (WSL) offers the best of both worlds. This article takes you through every step of installing Ubuntu on Windows 10 and Windows 11, troubleshooting common pitfalls, and customizing your Linux environment for optimal productivity.
Why Install Ubuntu on Windows?
- Access to Linux ecosystem: Use powerful open‑source tools like grep, awk, ssh, Docker, Node.js, Python, and more—all natively.
- Seamless interoperability: Call Windows executables from within Linux and vice versa—e.g., run notepad.exe or access \\wsl$\Ubuntu\home\user.
- Resource efficiency: Unlike full VMs, WSL has minimal overhead, booting in seconds with low RAM/CPU usage.
- Simplified development workflow: Compile Linux binaries, test scripts, or deploy applications in an environment matching production servers.
Understanding Windows Subsystem for Linux (WSL)
WSL is a compatibility layer that allows Windows to run Linux ELF‑64 binaries natively. There are two major versions:
- WSL 1: Translates Linux system calls to Windows calls. Good for lightweight tasks and low resource usage, but limited compatibility and slower networking.
- WSL 2: Uses a real Linux kernel in a lightweight VM. Offers full system call compatibility, better file system performance (for Linux files), and built‑in support for Docker.
By default, wsl --install on Windows 11 sets up WSL 2, and you can upgrade or downgrade as needed.
Prerequisites and System Requirements
Windows Version and Build
- Windows 10: Must be version 2004 (Build 19041) or later to support WSL 2.
- Windows 11: Out‑of‑the‑box support for WSL 2 in all releases.
Check your Windows version:
winver
Virtualization Support
- BIOS/UEFI virtualization must be enabled.
- Reboot and enter BIOS/UEFI settings.
- Enable Intel VT‑x / AMD‑V in Advanced CPU settings.
- Save and exit.
Administrative Privileges
- You need to run PowerShell or Command Prompt as Administrator for WSL feature activation.
Enabling WSL on Windows 10
1. Via PowerShell
- Open Start, type PowerShell, right-click and select Run as Administrator.
- Execute:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
- Reboot your machine.
- Set WSL 2 as default:
wsl --set-default-version 2
2. Via Control Panel
- Open Control Panel → Programs → Turn Windows features on or off.
- Check Windows Subsystem for Linux and Virtual Machine Platform.
- Click OK, then Restart now.
Enabling WSL on Windows 11
On Windows 11, Microsoft simplified WSL installation.
1. Using the wsl --install Command
- Open Windows Terminal (Admin).
- Run:
wsl --install
- This command will:
- Enable the required optional components.
- Download and install the latest WSL 2 Linux kernel.
- Set WSL 2 as the default.
- Install Ubuntu as the default distribution.
- Reboot if prompted.
2. Manual Feature Activation
Alternatively, repeat the PowerShell steps described for Windows 10, then download the kernel update package from Microsoft’s site and install it manually.
Installing Ubuntu from the Microsoft Store
- Open the Microsoft Store app.
- Search for Ubuntu. You’ll see several versions (20.04 LTS, 22.04 LTS, 23.10, etc.).
- Select your desired release (LTS versions recommended for stability).
- Click Get (or Install).
- Once installed, click Launch.
First‑Time Setup
- On first launch, a console window appears.
- It completes extraction (~1–2 minutes).
- You’ll be prompted to create a UNIX username and password. This account is separate from your Windows user.
Updating and Upgrading Ubuntu
After installation:
sudo apt update sudo apt upgrade -y
- apt update refreshes package lists.
- apt upgrade applies upgrades.
- Consider sudo apt full-upgrade once in a while to handle kernel-related changes.
Installing GUI Applications (WSLg)
Windows 11’s WSLg (Windows Subsystem for Linux GUI) lets you run Linux GUI apps seamlessly:
- Ensure you’re on Windows 11 and WSL is up to date:
wsl --update
- Launch a GUI app, e.g.:
sudo apt install gedit -y gedit
A window will pop up like any native Windows app. No additional X server configuration needed.
Managing Multiple Distributions
To view installed distros:
wsl --list --verbose
- Install another distro: wsl --install -d Debian
- Set default distro: wsl --set-default <DistributionName>
- Export/Import for backups:
wsl --export Ubuntu ubuntu-backup.tar wsl --import UbuntuBackup C:\WSL\UbuntuBackup ubuntu-backup.tar --version 2
Customizing Your Ubuntu Environment
Installing Common Developer Tools
sudo apt install build-essential git curl wget vim -y
- build-essential: gcc, make, and related compilers.
- git: Version control.
- curl/wget: Download utilities.
- vim: Text editing.
Shell and Prompt Customization
- Install Oh My Zsh:
sudo apt install zsh -y sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" chsh -s $(which zsh)
- Add plugins like git, z, autojump, and change themes (e.g., powerlevel10k).
Integrating with Windows File System
- Access Windows drives at /mnt/c, /mnt/d, etc.
- To speed up Linux file operations, keep project files within the Linux home directory (~), not on /mnt.
Troubleshooting Common Issues
WSL Version Mismatch
- If you see “Requested operation requires elevation”, rerun PowerShell as admin.
- To convert an existing distro to WSL 2:
wsl --set-version Ubuntu 2
Networking Problems
- WSL’s default NAT network may cause limited connectivity.
- You can configure static IP, or if using Docker Desktop, enable “WSL integration”.
Slow File I/O
- Avoid heavy I/O on /mnt drives—use Linux native paths.
- Use rsync for faster sync between Windows and Linux.
Store Installation Errors
- If the Store refuses to install, download the .appx package from the Ubuntu website and install via:
Add-AppxPackage .\Ubuntu.appx
Uninstalling or Resetting Ubuntu
- Reset (keeps app, deletes data):
Settings → Apps → Ubuntu → Advanced options → Reset - Uninstall (removes app and data):
Right-click Ubuntu in Start menu → Uninstall - Clean up WSL kernel updates:
wsl --unregister <DistributionName>
Conclusion
Installing Ubuntu on Windows 10 or 11 via WSL opens a gateway to a robust Linux environment without leaving Windows behind. From setting up developer toolchains to running GUI applications seamlessly, WSL bridges the gap between ecosystems. Whether you’re on Windows 10 or the latest Windows 11, follow these steps to enjoy the best of both worlds: the stability of Windows and the flexibility of Linux.