How to install WSL on Windows 10
WSL, the Windows Subsystem for Linux, is a free, optional feature of Windows 10 that allows Linux programs to run on Windows. It provides you with a Windows version of the bash shell and a compatibility layer that permits many Linux programs to run natively on your Windows machine.
Before installing WSL, make sure that your computer meets the minimum system requirements to run WSL:
- You must be running Windows 10 version 1607 (the Anniversary update) or above.
- WSL will only run on 64-bit versions of Windows 10. 32-bit versions are not supported.
To check that you meet these requirements, follow these steps:
- Open your Settings. You can do this by clicking the gear icon on the Start Menu, or by opening the Power User Tasks menu and choosing Settings.
- In the Settings window, choose System.
- On the left side of the System window, choose About.
- On the right side of the window, you will see your system information. Make sure that the Version is at least 1607, and the System type is a 64-bit operating system.
If the "Version" number is less than 1607, you will need to perform a Windows Update before installing WSL.
If your "System type" is not a 64-bit operating system, you will not be able to run WSL.
To install WSL, follow these steps.
Note: Versions of Windows previous to the Fall Creator's update used different instructions. These instructions are current as of November 2017.
- Open a new PowerShell window as Administrator. To do this, open your Start Menu, scroll down to W, and expand the Windows PowerShell folder. Right-click Windows PowerShell, choose More, then Run as administrator.
- At the PowerShell prompt, run this command:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
- Some necessary software will download, and the WSL subsystem will be enabled after you reboot. Linux itself is not installed yet, however (until you choose a Linux distribution, in step 5.)
- When the download is complete, PowerShell will ask if you're ready to reboot the computer. Before rebooting, make sure any documents are saved, and any open applications are closed. Type Y, or if you're going to reboot later, type N.
- After your computer reboots, log in to Windows and open a new Command prompt (or PowerShell). At the prompt, run:
- Bash will inform you that no distribution is installed, and give you a URL for downloading one from the Windows Store:
Windows Subsystem for Linux has no installed distributions. Distributions can be installed by visiting the Windows Store: https://aka.ms/wslstore Press any key to continue...
- In a web browser, navigate to the URL https://aka.ms/wslstore to download a WSL-integrated Linux distribution. As of this writing, choices are Ubuntu, OpenSUSE Leap, and SUSE Linux Enterprise. SUSE Linux is a stable, reliable Linux distribution, but if you're not sure what to pick, we recommend Ubuntu.
- Click Get.
- When the installation is complete, click Launch.
Note: You may receive this error:
Installing, this may take a few minutes... Installation failed! Error: 0x8000000d Press any key to continue...
This error is a known bug that has occurred in some versions of Windows 10. If you get this error, you can fix it by repeating steps 1 and 2. Then, continue to step 10.
- Ubuntu is now installed, and WSL is enabled. You can open the WSL Ubuntu command prompt by clicking the Launch button in the Windows Store or in the Start Menu by choosing Ubuntu. You can also open a command prompt (or PowerShell) and run bash.
Congratulations! Linux is running. You're now at the bash prompt, and you can run Linux commands and programs.
Getting started with your new subsystem
The first time you use Ubuntu on Windows, you'll be logged in as root, which is the administrator account on your Linux system. When you're logged in as root, the prompt ends in a #. When you're logged in as a normal user, the prompt ends in a $.
Create a new user
It's not safe to be logged in as root, unless you're doing something specific that requires elevated privileges. It's better to log in as a "normal" user account. You should create one now, with the adduser command.
Pick a name for your new user. It can be anything you like — make it something simple, in all lowercase, with no punctuation. Your first name is a good choice.
In this example, we picked the username hope.
You will be asked to enter and verify a password for the user account. You can press Enter when you are asked for information such as Full Name, or type this information to be added to the user account. Type y when everything is correct, and the account will be created.
You now have a new directory on your Linux system, /home/username/, and a new user and dedicated user group, both called username.
To change to this user now, use the su ("switch user") command.
Notice that your prompt has changed: it's in color, because of the settings in your user's new bash profile, /home/username/.bashrc. Also, notice that your username is at the beginning of the prompt, and the prompt ends in a dollar sign ($) to indicate that you're not currently logged in as root.
Update your Linux software
Linux software is frequently updated, and individual packages can be updated independently, along with their dependencies, if necessary. It's not unusual to find that updates are available several times in a week. Most are not critical updates, so it's OK to update less frequently.
Now is a great time to perform a software update. Follow the instructions below to update your software with the apt command.
Just like Ubuntu, WSL uses the APT (advanced packaging tool) to manage software packages. The apt command allows you to search for, download, and install software, all from the command line. It automatically manages your software dependencies for you, so if one program depends on a certain version of another program, both will be installed, and kept up-to-date.
Any apt commands that make changes to your system must be run as root. If you're logged in as your regular user (as you usually should be), you can run a program as root by prefixing it with the command sudo ("superuser do"). It requires that you enter your password, and your program is run as root.
sudo apt update
[sudo] password for hope:
Updates will download, but nothing is installed or upgraded yet. To upgrade all available packages, run:
sudo apt upgrade
Tip: Sudo will not ask you for your password this time, unless it has been more than five minutes since the last sudo command.
The size of the upgrades will be calculated, and you will be prompted to continue. Type y and press Enter. The upgrades will download and install, which might take a while, depending on the speed of your computer and Internet connection.
When the upgrade is complete, you will be returned to the bash prompt. Your Linux system is now up-to-date.
At any time, you can exit bash using the exit command.
The Windows and WSL filesystems
WSL has its own filesystem. This Linux filesystem has been installed to your Windows filesystem at:
For instance, if your Windows username is Owner and Windows is installed on your C: drive, your WSL filesystem is located at:
It's good to know that this is where it's located, but you shouldn't move this or make any changes to the files it contains.
When you're using WSL, you might be wondering how you can access your Windows files. Your C: drive is located at:
The name mnt stands for "mount," which is where your Windows drives are mounted within WSL. For instance, your D: drive would be /mnt/d/, etc.
Creating symbolic links to Windows folders
For convenience, it's a good idea to create symbolic links to your Windows home folder. A symbolic link is similar to a shortcut in Windows: it's a file that points to another file or directory. When you refer to the symbolic link, the system will dereference the link, and behave as if you had specified the actual "target" file or directory.
Using symbolic links can save you a lot of typing, and remembering of obscure directory names.
For instance, to create a symbolic link in your WSL home folder called winhome that refers to C:\Users\Owner\, follow these steps.
Next, use ln -s to create the symbolic link. For instance, if your Windows home folder is C:\Users\Owner\, the command would be:
ln -s /mnt/c/Users/Owner/ winhome
Now there's a symbolic link called winhome in your WSL home directory, which acts like a shortcut to your Windows home directory. So, you can change to your Windows home directory using:
Or, to change to your Windows desktop folder:
More information about Linux commands
Enjoy your new Linux subsystem! Make sure to visit our overview of Linux commands for more information about tools and programs you can use.