It is my personal preference to stay away from the official Microsoft Store App. This avoids having to battle bloat and self-installed (unwanted) apps and previews. This guide will teach you how to install the Windows Subsystem for Linux (wsl) without the Microsoft store.
I always recommend dual-booting Linux directly as the process is simple and painless but for a work environment (such as my specific scenario), switching between two Operating systems is not ideal or worth the hassle.
Windows 10 Pro (If you intend to use wsl 2) otherwise you can get away with installing wsl1
Distro of choice from this list. (This guide uses LTS 20) // Navigate to Downloading Distros
We begin by enabling the required features and invoke the following commands using the PowerShell (as Admin) [ R-Click on the Start menu > Windows PowerShell (Admin)
# This command will enable the Windows Subsystem for Linux dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Enable the Virtual Machine Feature
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
We are ready to download the distro of our choice. You can download the distro from the provided list of available downloads. I downloaded from the link provided and chose Ubuntu 20.04 for my 64-bit machine.
Next, we need to invoke the following command. Note: You can rename the .appx to something shorter like LinuxLTS20, etc.
Navigate to the appropriate directory:
We'll pretend I kept the file in my downloads and I renamed it to lts20.appx cd c:\users\your-name\downloads\ Now that we are in the correct directory, we invoke the install command using the example from above. Add-AppxPackage .\lts20.appx
Your distro is ready to be used and can be accessed from the start menu. Mine is labeled as Ubuntu 20.04 LTS. Launch your newly installed distro and we are ready to begin the actual installation.
If you encounter the following error, a restart is necessary.
Installing, this may take a few minutes... WslRegisterDistribution failed with error: 0x8007019e The Windows Subsystem for Linux optional component is not enabled. Please enable it and try again. See https://aka.ms/wslinstall for details. Press any key to continue...
Restart your machine and attempt to launch Ubuntu 20 LTS once more.
Setting up Linux
If you've done everything correctly, you will be greeted with the following message when you launch the app:
'Installing, this may take a few minutes...'
You will need to create a user account and password for it (different from main account). Don't worry. This is mostly for the sake of creating the home folders, environment, etc. You won't need to leave your main account.
Enter a new UNIX username: # Enter a new username
New Password: #This also controls your root/sudo account
Confirm your password and you are all set. Before we begin to use Linux as intended, we need to update it to WSL 2 (if applicable)
Update to WSL 2
- For x64 systems: Version 1903 or higher, with Build 18362 or higher.
You can check this information in [START] > Settings > Update & Security > Windows Update > OS build info
You will need the Linux kernel update package. Note: This is for 64-bit machines. To know what type of machine you have, you can run this command.
systeminfo | find "System Type"
Launch the wsl_update_x64 and you'll be greeted by an installation window. Select Next > Accept the prompt that comes up > Finish
Finally, we need to set WSL 2 as our default version.
Launch PowerShell (as Admin) and type:
wsl --set-default-version 2
You are done and you can now start to use the Linux terminal alongside Windows.
Where are my user folders located in WSL?
The user folder structure seems to be mapped to a network in the same way we access a deployment share.
Navigate to: \\wsl$\Ubuntu-20.04\home which is dependent on your Ubuntu distribution. Alternatively (inside your Linux terminal), type:
This will launch the File Explorer window and you can simply backtrack to see all your folders.
I hope you found this guide useful. As a final note, I find that Windows Subsystem for Linux is perfect for server management, accessing files and editing (everything you expect from a VPS) but tricky and difficult to setup for theme development or physically moving files around (at least with wsl1), etc. You won't have any issues accessing and backing up your SSH keys, however.