Digital Marketing Agency | SEO, Paid Social & PPC

How to install the elementary OS on WSL for Windows

Share This Post

The Windows Subsystem for Linux (WSL) lets developers run a GNU/Linux environment including most command-line tools, utilities, and applications directly on Windows, unmodified, without the overhead of a traditional virtual machine or dual-boot setup.

WSL 2 is a new version of the Windows Subsystem for Linux architecture that powers the Windows Subsystem for Linux to run ELF64 Linux binaries on Windows. Its primary goals are to increase file system performance, as well as add full system call compatibility.

This new architecture changes how these Linux binaries interact with Windows and your computer’s hardware, but still provides the same user experience as in WSL 1 (the current widely available version).

Individual Linux distributions can be run with either the WSL 1 or WSL 2 architecture. Each distribution can be upgraded or downgraded at any time and you can run WSL 1 and WSL 2 distributions side by side. WSL 2 uses an entirely new architecture that benefits from running a real Linux kernel.

Windows Subsystem for Linux 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 are not limited to only those available through the Store. With the right tools and know-how, you can get just about any distro working.

You can install the latest rolling release with an official image in Ubuntu and in others, we turn to the WSL community for assistance, and that is where we are at with elementary OS.

Installing elementary OS onto WSL is a simple process that takes a matter of minutes, followed by some pretty simple setup.

elementary OS on WSL

How to install elementary OS on WSL

Elementary OS is a Linux distribution based on Ubuntu LTS. It promotes itself as a “thoughtful, capable, and ethical” replacement to macOS and Windows and has a pay-what-you-want model. The operating system, the desktop environment (called Pantheon), and accompanying applications are developed and maintained by Elementary, Inc.

It 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 do not get the gorgeous user interface, but if you need it or just want it, you can have it.

If you want to use it on WSL, you will be wanting to use a community project simply called Elementary WSL. It is hosted at GitHub, so the first port of call is to load up its repository. It’s also only built for WSL 2.

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.

This will take a few seconds or longer depending on the hardware you are running its installation, but the installer does not require any interaction from you. It will open a terminal window, and when it is complete you will 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 will only have root access, so you will need to do some basic setup before you get rolling.

You may also like How to enable Auto HDR in Windows 11

How to set up elementary OS on WSL

To set up elementary OS on WSL, you have to load up elementary OS in your terminal using one of the methods described above. You will be presented with a basic prompt that begins with root@. As with any other Linux distro on WSL, you will 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:

passwd

Follow the prompts to set a root password. Next, we’ll add a user with:

useradd -m <username>

And then we’ll follow that up with a password for the user with:

passwd <username>
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>

You can then switch to your user with:

su <username>

The next thing to do is to ensure that when you launch elementary, you are doing so as a 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 will need to create that and enter the right settings. As we are going to be inside the /etc/ directory it’s easiest to be root for this one. In the terminal as root enter:

nano /etc/wsl.conf

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, and then when you relaunch you should be ready to go, already logged in as a 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>

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. 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

You may also like A Step-by-Step Guide on How to Create Partitions in Windows 11/10

Using the bash shell with elementary OS on WSL

Elementary WSL 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 bash 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 used 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 chsh command which, as you may guess, changes shell. Enter chsh into the terminal followed by your password. When prompted enter /usr/bin/bash 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.

You may also like Windows 11.1 Download: What Is The First Impression

Alternatively, if you use Windows Terminal you can simply instruct elementary OS to go into bash as it loads. In the settings, under the Command line on the general tab ensure the box reads:

wsl.exe -d Elementary bash

This is a quick fix, but the chsh method is recommended. And naturally, the course of action for anyone using a different terminal application.

That’s all, and elementary OS is now set up on WSL for you to use just like any other you would install through the Microsoft Store.

In addition, 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.

Would you like to read more  Ubuntu on WSL for Windows 11-related articles? If so, we invite you to take a look at our other tech topics before you leave!

Subscribe To Our Newsletter

Get updates and learn from the best