Installing Linux onto Windows with WSL
Steps for installing WSL, installing Linux, uninstalling Linux, and looking at your versions.
Table of Contents
I’m starting to play around with other developer languages, like Ruby, and wanted to set up a development environment on my Windows machine, which I typically only use for gaming. The first step was to set up WSL (Windows Subsystem for Linux) which allows me to run Linux CLI on Windows.
WSL
WSL (Windows Subsystem for Linux) allows you to run Linux directly on your Windows machine. This is useful for development, for example, when you need to use Linux but don’t want to switch to a separate Linux machine or VM.
Installing WSL
To install WSL on Windows, you need to use PowerShell. You’ll run a command to enable the feature. Restart your computer (got to love Windows) and then update WSL and then you’ll be ready to install Linux.
- Open the Windows PowerShell in the Terminal with administrator privileges.
- Run the command
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
. - When prompted to restart the computer, select Yes.
- Return to the Terminal and ensure WSL is updated by running the command
wsl.exe --update
to ensure everything is up to date. - When finished, restart your computer, again.
Installing Linux
You can choose which version of Linux to install and run a few commands to get it started.
- Run the command
wsl --list --online
to see the available Linux distributions that can be installed. - Install the latest Ubuntu LTS version using the command
wsl --install Ubuntu-24.04
. - When the installation finishes successfully, you will be prompted for a username and password. Enter then and save them in your favorite password manager.
Checking your version of Linux
- Open the Windows PowerShell in the Terminal with administrator privileges.
- Run the command
wsl -l -v
.
Running Linux
When you install Linux, a profile is automatically created in your terminal. You can select it in a new tab.
Uninstall a version of Linux
If you want to uninstall a version of Linux.
- Open the Windows PowerShell in the Terminal with administrator privileges.
- Run the command
wsl --uninstall Ubuntu-24.04
.
Reference
The Weekly Cache
A weekly newsletter where I share what I did, what I learned, what I discovered, what I read, and more. Each edition is short and to the point, and packed with interesting links.