To install Ubuntu on Windows 10 using WSL2 (Windows Subsystem for Linux version 2), follow these steps:
Step-by-Step Guide to Install Ubuntu on Windows 10 with WSL2
Enable WSL and Virtual Machine Platform:
Open PowerShell as Administrator. You can do this by right-clicking on the Start button and selecting “Windows PowerShell (Admin)”.
Run the following commands to enable WSL and the Virtual Machine Platform:
powershelldism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Set WSL2 as the Default Version:
To set WSL2 as the default version, run:
powershellwsl --set-default-version 2
Restart Your Computer:
- Restart your computer to apply the changes.
Install Ubuntu from Microsoft Store:
- Open the Microsoft Store app.
- Search for “Ubuntu” and select your preferred version (e.g., Ubuntu 20.04 LTS).
- Click on the “Get” button to download and install Ubuntu.
Initialize Ubuntu:
- After installation, open the Ubuntu app from the Start menu.
- A console window will open, and Ubuntu will initialize. This may take a few moments.
- You’ll be prompted to create a new UNIX username and password. This username and password are for your Ubuntu environment.
Check WSL Version:
To ensure that your Ubuntu installation is using WSL2, run the following command in PowerShell:
powershellwsl --list --verboseYou should see Ubuntu listed with version 2 next to it. If it shows version 1, you can change it to WSL2 by running:
powershellwsl --set-version Ubuntu-20.04 2
(Replace
Ubuntu-20.04with the exact name of your Ubuntu installation if it's different.)Start Using Ubuntu on WSL2:
- You can now start using Ubuntu by launching it from the Start menu or by typing
wslin PowerShell or Command Prompt.
- You can now start using Ubuntu by launching it from the Start menu or by typing
Additional Tips
- Update and Upgrade Ubuntu: Run
sudo apt update && sudo apt upgradein your Ubuntu terminal to keep your packages up to date. - Access Windows Files: You can access your Windows files from Ubuntu via the
/mnt/cdirectory (for the C: drive).
That's it! You now have Ubuntu running on Windows 10 using WSL2, allowing you to use Linux commands and software directly within Windows.
* folder data: C:\Users\{user_name}\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu_..
Thank you