Skip to content

Windows Subsystem for Linux

After Windows 10 version 20H1 (build 19041) released in May 2020, and on all editions of Windows 11, Microsoft provides official support for the Windows Subsystem for Linux (WSL) feature. If you are running Windows 10 version 20H1 or later, or any version of Windows 11, you can install one or more Linux distributions directly via the WSL command-line tool.

With this kind of environment in place you will be able to connect to the clusters as explained in the how to connect from a UNIX-like environment guide.

Almost all HPC clusters run Linux, and the software ecosystem in Academia is designed for Linux environments. As summarised in From Subsystem to Super System – WSL, a Gateway to HPC, WSL lets you build and test your pipelines locally before scaling to HPC, ensuring a Linux environment on both sides.

Installation

To verify you Windows version you are running, open the Settings panel and go to System > About, you should see a screen similar as this one:

win_build_number

If your Windows 10 version is 20H1 (build 19041) or later, or if you’re on Windows 11, you are on the easy path. See the following steps to enable the feature and install a supported Linux distro. If you're running an older Windows 10 version and cannot update your Operating System, choose the second tab (minimal OS build version is 16215).

  1. Open PowerShell as Administrator, and run:

    wsl --install
    
    This command will enable the WSL and Virtual Machine Platform features. It will also download and install a default distro (Ubuntu), and launch the distro’s first-run setup.

  2. Wait for the installation to complete then you will be prompted to create your Linux user. Create your UNIX username and password. This user account has no relationship to your Windows username and password and hence both can be different. Learn more about your UNIX account.

  3. After you finished the setup follow the section how to connect from a UNIX-like environment to connect to the clusters. Notice that all your Windows partitions will be automatically mounted at the /mnt path inside the Linux environment, e.g. C:\ will be at /mnt/c.

Using another Linux distro

If you intend to use another Linux distribution, you can see the list of available distribution using the following command in PowerSheel:

wsl --list --online
To install another distro (for example Debian):
wsl --install -d Debian

  1. Open the Settings panel and search for the Turn Windows Features on or off dialog as shown below:

    windows_features

  2. In this dialog box look for the Windows Subsystem for Linux option and enable it. Click OK and you'll be prompted to reboot, this is required WSL will not work until you've rebooted!

    wsl_option

  3. After restarting, open the Microsoft Store and look for an available Linux distribution. Here are direct links to some store installers:

  4. You'll see a screen like the following, select Get to start the installation:

    winstore_ubuntu

  5. Once the installation has completed, select Launch. This will open a console window. Wait for the installation to complete then you will be prompted to create your Linux user account as shown below:

    linux_first

    Create your UNIX username and password. This user account has no relationship to your Windows username and password and hence both can be different. Learn more about your UNIX account.

  6. After you finished the setup follow the section {ref}how to connect from a UNIX-like environment <unix-ssh-connection> to connect to the clusters. Notice that all your Windows partitions will be automatically mounted at the /mnt path inside the Linux environment, e.g. C:\ will be at /mnt/c.

Set up X11 forwarding

Windows 11: Linux GUI works out of the box. No external X server is needed.

Windows 10: As windows 10 does not have an X11 server installed by default you'll need to install a package providing one. You can use the VcXsrv software for that. We'll assume in the rest of this guide that you are using the Ubuntu Linux app provided in the Windows Store.

  1. Download the latest VcXsrv version from here, make sure to choose the vcxsrv-64.version.number.installer.exe file. Follow the install procedure and go for the full install.

  2. Launch the program, you'll get a wizard setup, leave all the default options, in the final screen choose Save configuration, you'll be prompted to save a file that will work as a launcher with those options, is reasonable to save it on your Desktop.

  3. Open the Ubuntu Linux app and install the following packages:

    sudo apt install xauth x11-common x11-apps ssh
    

    add export DISPLAY=localhost:0 to your .basrc file, you can use the following command:

    echo "export DISPLAY=localhost:0" >> ~/.bashrc
    

    Restart the terminal, this is an important step, the settings will not take effect until you close it and open a new one.

  4. In the new terminal, you can verify that your local Xserver is working by running xcalc or xeyes. To connect to the clusters it is recommended to use an SSH config file and make sure you have the following options active for them:

    ForwardAgent yes
    ForwardX11 yes
    ForwardX11Trusted yes
    
  5. Login in the cluster, you should be able to run your graphical application. If you get some warnings during the login about No xauth data you can add the line XauthLocation /usr/bin/xauth at the bottom of the /etc/ssh/ssh_config file in your local Ubuntu Linux environment.

Take note that in future use you should always have an active X server running (make sure to have the xserver icon in your taskbar) before running the Ubuntu Linux app.