Skip to content
Semillero
ARES

WSL

Installing WSL on Windows 11

By Juan Felipe Martínez Bedoya

WSL (Windows Subsystem for Linux) lets you work with Linux from Windows, as if you had a Linux computer.

This tutorial explains how to install WSL and how to open Linux graphical windows on Windows with an X server. It is written for Windows 11; for earlier versions the process is more complicated, and these guides may help:

Installing WSL on Windows 11

This tutorial is based on a video by Horus Lugo and an article by Oscar Barajas (both in Spanish).

Open the Windows command prompt as administrator:

Command prompt as administrator

Run:

wsl --install

When the download finishes, restart the computer and open the Ubuntu app. The first time, it asks you to choose a user name and password.

Then check the version:

lsb_release -a

Ubuntu version

If the version is 22.04, you are all set. Otherwise, search for and install Ubuntu 22.04 LTS from the Microsoft Store.

Ubuntu 22.04 in the Microsoft Store

X server for graphical apps

Recent versions of Windows 11 include WSLg, which shows Linux graphical apps with no extra setup. If it does not work on your machine, you can use an X server as explained below.

On Windows

We follow Aitor Alonso’s article.

Download and install VcXsrv. Then open the XLaunch app and follow these steps:

XLaunch, step 1

XLaunch, step 2

XLaunch, step 3

At the end you can save the configuration to a file so you do not have to repeat the steps each time.

On Ubuntu

For Ubuntu to send windows to the X server, set the DISPLAY environment variable:

export DISPLAY="`grep nameserver /etc/resolv.conf | sed 's/nameserver //'`:0"

This only lasts while the terminal is open. To make it permanent, add that line at the end of ~/.bashrc:

cd ~
vi .bashrc

If you have questions about these commands or about vi, see the Linux commands and vi editor tutorials.

Close the terminal and open it again to check that it worked.

Testing

Install some test apps:

sudo apt install x11-apps

And run either of these:

xeyes

xeyes

xcalc

xcalc

Opening from the saved file

If you saved the configuration, just open the file and choose to open it with XLaunch.

Opening the configuration with XLaunch

Installing ROS 2

In the group we work with ROS 2. For Ubuntu 22.04 the matching version is Humble; follow the official installation guide.

Translated from Spanish.