The Windows Subsystem for Linux (WSL) is an incredibly powerful tool for both Windows 10 and Windows 11 with a raft of easily installable distros at hand in the Microsoft Store. But you're not limited to only those available through the Store. With the right tools and know-how, you can get just about any distro working.
In some cases, such as Ubuntu, you can install the latest rolling release with an official image. In others, we turn to the WSL community for assistance, and that's where we're at with elementary OS.
Thanks to a project hosted on GitHub, installing elementary OS onto WSL is a simple process that takes a matter of minutes, followed by some pretty simple setup.
How to install elementary OS on WSL
Elementary OS is an Ubuntu-based Linux distribution and one of the more mainstream options out there, with one of the most pleasing user interfaces around. Of course, using Linux in WSL is a little different from just loading it up on a PC, and you don't get the gorgeous UI, but if you need it or just want it, you can have it.
So, if you want to use it on WSL, you'll be wanting to use a community project simply called ElementaryWSL. It's hosted at GitHub, so the first port of call is to load up its repository. It's also only built for WSL 2, so if you aren't using that yet, check out our full guide to get ready.
On the GitHub repository, hit the releases page and download the latest package. Once downloaded, extract the zip file to the directory you want to run it from, then simply run elementary.exe. Unlike installing Ubuntu's latest releases from one of the official images, this has been bundled up to resemble more the distros you would download from the Microsoft Store with a similar installation process.
It'll take a few seconds (or longer depending on your hardware) to run its installation, but the installer doesn't require any interaction from you. It'll open a terminal window, and when it's complete you'll be asked to press Enter. The terminal window will then close.
If you use Windows Terminal, Elementary will now show in the dropdown menu to launch the next time you load it up. If you don't, you can launch it through PowerShell the same as any other Linux distro with this command:
wsl -d Elementary
By default you'll only have root access, so you'll need to do some basic setup before you get rolling.
How to set up elementary OS on WSL
Load up elementary OS in your terminal using one of the methods described above. You'll be presented with a basic prompt that begins with
. As with any other Linux distro on WSL, you'll want to add a user with the right permissions before doing anything. You don't have a password, either, so you'll need to add one of those before beginning.
In the terminal enter:
Follow the prompts to set a root password. Next, we'll add a user with:
useradd -m <username></username>
And then we'll follow that up with a password for the user with:
Again, follow the prompts to add your password. These commands have added a root password, a user, and a user password.
The next step is to add the right permissions to your user to be able to use the sudo command, otherwise you'll be met with an error. We can do this by entering:
usermod -aG sudo <yourusername></yourusername>
You can then switch to your user with:
The next thing to do is to ensure that when you launch elementary, you're doing so as user and not root (which is advisable). There are two ways to do this, the first is with the wsl.conf file and the second is by configuring Windows Terminal if you use that.
You won't have a wsl.conf file out of the box so we'll need to create that and enter the right settings. As we're going to be inside the /etc/ directory it's easiest to be root for this one. In the terminal as root enter:
The Nano text editor will now open with a new blank file. Enter this block into the file:
# Set the user when launching a distribution with WSL.[user]default=YourUserName
Hit Ctrl + X followed by Y and then Enter to save and exit. Close down your elementary instance, wait a few seconds (eight is the official line from Microsoft), and then when you relaunch you should be ready to go, already logged in as user.
Alternatively, if you're using Windows Terminal, open the Settings, find your Linux Mint install in the sidebar, and then in the command line box ensure this command is stored:
wsl.exe -d <distroname> -u <yourusername></yourusername></distroname>
This will have the same effect once closed down and restarted. Setting up a wsl.conf file is preferable, though, as it ensures you're always entering as user and can also store additional settings for your distro.
You'll also find a number of fairly basic functions and apps that don't seem to be installed (at least in the build at the time of writing). For example, I had to install the Nano text editor, Git, and wget in the course of setting up elementary OS. Those are three you should definitely add and all are available in the apt repository.
sudo apt install nano wget git
Using the bash shell with elementary OS on WSL
For whatever reason, ElementaryWSL sets up and loads into the sh shell, not the more common bash. The sh shell is actually a legacy tool, and you don't really want to use it. You can get into a more recognizable bash environment simply by entering
in the terminal, but that's going to get tedious. So we need to set it up to do it for us.
Note, these steps can also apply to other shells such as Fish or zsh, but we're using bash for the purposes of this guide as it's already installed. There are two things you can do.
The first is to use the
command which, as you may guess, changes shell. Enter
into the terminal followed by your password. When prompted enter
as your choice and hit Enter. Close down your instance, give it the eight seconds, then next time you load it up you'll be in the bash shell instead.
Alternatively, if you use Windows Terminal you can simply instruct elementary OS to go into bash as it loads. In the settings, under Command line on the general tab ensure the box reads:
wsl.exe -d Elementary bash
This is a quick fix, but the
method is recommended. And naturally, the course of action for anyone using a different terminal application.
That's all there is to it, and elementary OS is now set up on WSL for you to use just like any other you would install through the Microsoft Store.
Additionally, you can run multiple instances of elementary OS on WSL. For each subsequent installation, simply change the name of the elementary.exe file from the top of this guide to something else, then run it again. The new instance will be set up with the changed file name, but it does allow you at least to run multiple instances alongside one another.
Richard Devine is an Editor at Windows Central. A former Project Manager and long-term tech addict, he joined Mobile Nations in 2011 and has been found on Android Central and iMore as well as Windows Central. Currently you'll find him covering all manner of PC hardware and gaming, and you can follow him on Twitter and Instagram.
With this simplicity, I can see why Windows needs to be afraid of Linux OS world take over
Lol, not gonna happen. Linux may have its appeal when it comes to free and open source softwares, but its ongoing fragmentation is not going to bring more people to Linux. I myself used to be a full-time Linux user before I switched to Windows 10 since Anniversary Update and I never looked back.
Why would you, though? What are the advantages? What does Linux have that Windows doesn't? Seriously, I don't get it and I'm actually not being sarcastic.
Linux does works best for servers. Microsoft themselves use Linux to run Azure servers. If you are a FOSS advocate, Linux is also the one to go for.
What these previous posters said...
I hate to be "that guy" who complains about articles that I don't personally care about, but you actually have two articles about Linux distros on Windows today. This is precisely why I can't get all excited about it. When every person wants their own version of the OS, and you have to maintain them separately, it sounds awful.
I understand that there are certain business functions that work well in Linux, but that seems like more of an edge case for the Windows Central community.
Unfortunately you'll be heckled and be told that it's their website and they can post whatever they want.
There is no single OS news haven anymore on the Web, this was the last one.
Just gotta grin and bear it.
What the hell are you talking about? WSL is literally built into Windows 10 and 11. It's an important tool and I can tell you from our own analytics alone that it's substantially more popular than the white knights afraid of anything but "pure Windows" in the comments section know. Surface Duo runs Android but you all lap it up? There's literally no difference here. This is a tool built by Microsoft integrated in Microsoft's own desktop OS and we're going to cover it like we would every other part of Windows.
Get the best of Windows Central in in your inbox, every day!
Thank you for signing up to Windows Central. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.