This article was co-authored by wikiHow staff writer, Nicole Levine, MFA. Nicole Levine is a Technology Writer and Editor for wikiHow. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions.
This article has been fact-checked, ensuring the accuracy of any cited facts and confirming the authority of its sources.
This article has been viewed 193,945 times.
Learn more...
Want a full working Linux environment in Windows without having to dual-boot or use a virtual machine? If you're using Windows 11 or an up-to-date version of Windows 10, you can easily enable Windows Subsystem for Linux (WSL) and install Ubuntu (or your preferred Linux distro) using a single command in PowerShell. If you're using an earlier Windows 10 version, you'll need to enable Windows Subsystem for Linux first, then install your preferred distribution from the Microsoft Store. Installing WSL is easy, and we'll walk you through the steps.
Quick Steps
- Open PowerShell or Terminal as an administrator.
- Type "wsl --install" and press Enter to enable WSL and install Ubuntu.
- Create your Ubuntu Linux username and password.
- Launch WSL any time from the Start menu or using the "wsl" command.
Steps
-
Open PowerShell as an administrator. To do this, right-click the Start menu, then select Terminal (Admin) (Windows 11) or Windows PowerShell (Admin) (Windows 10). When prompted, click Yes to confirm.[1]
- If you're using Windows 10, you must be running Windows 10 2004 or higher to install WSL with this method. If you're using an older version of Windows 10 and cannot upgrade, you can still install it manually.
- To check your Windows version, press Windows key + R, type winver, and press ↵ Enter.
-
Type wsl --install and press ↵ Enter. This command will install Windows Subsystem for Linux, as well as Ubuntu Linux.[2]
- If you'd rather install a distribution other than Ubuntu, use the command wsl --list --online to view available distros, then use the syntax wsl --install <distroname> to install it.
- If you see the WSL help text when trying to install WSL, a version of WSL is already enabled. If you installed a legacy version of WSL, Microsoft recommends removing it before installing the latest version.To remove it, run the command wsl --unregister Legacy.[3]
Advertisement -
Set up your Linux user environment. Once installed, you will be prompted to create a username and password for Linux. The password you create will also be used when you run administrative (root) commands with sudo.[4]
- Now that WSL is installed, you'll have an entry for Ubuntu in your Start menu. You can also open WSL from Command Prompt or PowerShell by typing wsl and pressing ↵ Enter.
- To access your primary Windows drive from WSL/Ubuntu, use the command cd /mnt/c/Users/<UserName>.
-
Open PowerShell as an administrator. To do this, right-click the Start menu, then select Terminal (Admin) (Windows 11) or Windows PowerShell (Admin) (Windows 10). When prompted, click Yes to confirm.
- Use this method to enable and install Windows Subsystem for Linux on a version of Windows 10 that is too old to use the wsl --install command.[5]
-
Enter the command to enable WSL. Type the following command and then press ↵ Enter to enable the subsystem for Linux: dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart.
- This command will install WSL 1, the previous version of Windows Subsystem for Linux. Microsoft recommends updating to WSL 2 if your PC meets these requirements:[6]
- For x64 systems: Version 1903 or later, with Build 18362.1049 or later.
- For ARM64 systems: Version 2004 or later, with Build 19041 or later.
- To check your Windows version, press Windows key + R, type winver, and press ↵ Enter.
- This command will install WSL 1, the previous version of Windows Subsystem for Linux. Microsoft recommends updating to WSL 2 if your PC meets these requirements:[6]
-
Enable the Virtual Machine Platform. If you want to update to WSL 2, you'll need to complete this step. If not, restart your computer, then skip to step 5. Otherwise, to enable the VM platform, type dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart and press ↵ Enter.[7]
-
Install the Linux kernel update package. Now you'll need to download the latest kernel update package to update to WSL 2 and run its installer. Use the following download links to download the package for your platform. Once downloaded, double-click the file, and follow the on-screen instructions to install the kernel update.
- Update for x64-based systems
- Update for ARM64-based systems
- Not sure which to download? See How to Check PC Specs on Windows 10 to find your processor type.
-
Set WSL 2 as your default WSL version. Once the kernel update is installed, run this command in the PowerShell prompt: wsl --set-default-version 2.
-
Install your preferred Linux distribution. Now that WSL is enabled, you can install a WSL-compatible Linux distribution easily from the Microsoft Store. Here's how:[8]
- Open the Microsoft Store app.
- Search for your preferred Linux distribution, e.g., Ubuntu, Kali Linux, Fedora, Rocky Linux. You can also search for linux to see many options.
- Click Get on the distribution you want to install.
- After a few moments, a terminal window will expand, prompting you to create a username and password for your first Linux user.
-
Set up your Linux user environment. Once installed, you will be prompted to create a username and password for Linux. The password you create will also be used when you run administrative (root) commands with sudo.[9]
- Now that you've installed Linux in WSL, you'll have a new menu item in the Start menu for the distribution you installed. You can start your Linux shell by clicking the distribution in the Start menu, or by opening command prompt or PowerShell, typing wsl, and pressing ↵ Enter.
- To access your primary Windows drive from WSL, use the command cd /mnt/c/Users/<UserName>.
Community Q&A
-
QuestionI have a 16GB flashdrive. Unfortunately due to formatting error or improper unplugging, it has lost more of its MBS. Now I have a 2.19MB flash instead of a 16GB drive, how can I fix my problem?
Community AnswerIf you are using Windows, then use the built in command line utility called diskpart to clean the drive. Alternatively, if you are not confident with using command line utility, then use a third party graphical utility. I recommend one called "Rufus". Rufus is good because it's relatively easy and convenient to use, and it is pretty much impossible to damage your Windows drive with it.
Tips
-
Be sure to update and upgrade your Ubuntu packages regularly using the command sudo apt update && sudo apt upgrade.Thanks
-
New to Linux? Check out our handy Linux beginner's guides, like How to Find Files in Linux and How to Install Linux Software.Thanks
Video
References
- ↑ https://learn.microsoft.com/en-us/windows/wsl/install
- ↑ https://learn.microsoft.com/en-us/windows/wsl/install
- ↑ https://learn.microsoft.com/en-us/windows/wsl/troubleshooting#uninstall-legacy-version-of-wsl
- ↑ https://learn.microsoft.com/en-us/windows/wsl/setup/environment#set-up-your-linux-username-and-password
- ↑ https://learn.microsoft.com/en-us/windows/wsl/install-manual
- ↑ https://learn.microsoft.com/en-us/windows/wsl/install-manual#step-2---check-requirements-for-running-wsl-2
- ↑ https://learn.microsoft.com/en-us/windows/wsl/install-manual
- ↑ https://learn.microsoft.com/en-us/windows/wsl/install-manual
- ↑ https://learn.microsoft.com/en-us/windows/wsl/setup/environment#set-up-your-linux-username-and-password










