This guide will walk you through the process of installing the Windows Subsystem for Linux (WSL) and the Ubuntu distribution on your Windows machine.
Before you begin, you will need to have the following:
- Windows 10 or 11: You need to be running Windows 10 version 2004 or higher (Build 19041 and higher) or Windows 11.
- CPU Virtualization: You must have CPU virtualization enabled on your computer. This is usually enabled by default, but if you encounter any issues, you may need to enable it in your computer's BIOS settings.
-
Open PowerShell as Administrator. You can do this by searching for "PowerShell" in the Start menu, right-clicking on it, and selecting "Run as administrator".
-
Run the following commands one by one to enable WSL and the Virtual Machine Platform:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
-
Restart your computer to complete the installation of these features.
-
After restarting, open PowerShell as Administrator again.
-
Run the following command to install WSL and Ubuntu:
wsl --install
- Once the installation is complete, you can launch Ubuntu by searching for "Ubuntu" in the Start menu.
- The first time you launch Ubuntu, it will take a moment to set up. After that, you will be prompted to create a new username and password. This is a local user account for your Ubuntu environment, and it does not need to be the same as your Windows password.
-
Once your Ubuntu environment is set up, it's a good practice to update its packages. In the Ubuntu terminal, run the following command:
sudo apt update && sudo apt upgrade -y -
You will need to enter the password you created in the previous step.
-
It is also recommended to install some essential packages for development. You can do this by running the following command:
sudo apt install -y curl build-essential git wget
You can launch your Ubuntu distribution at any time by one of the following methods:
- From the Start Menu: Open your Start menu, type "Ubuntu", and click on the Ubuntu application.
- From PowerShell or Command Prompt: Open a new PowerShell or Command Prompt window and type
wslorubuntu.
Congratulations! You now have a full Ubuntu terminal environment running directly on your Windows machine.