The purpose of this page is to provide Windows Subsystem for Linux (WSL) users guidance on how to use X Window System (X11; X) forwarding with Teton.
X11 is a great tool for interactively viewing R plots, dialogue boxes, etc. on Teton. Unfortunately, X11 does not work with WSL "out of the box." However, it is still possible to use X11 with WSL, with a couple of modifications. Thankfully these modifications are relatively easy to implement.
Approximate time to complete: 5-20 minutes. This tutorial makes the following assumptions:
It is recommended that you read through the sections below before executing any of the instructions. |
To get X11 working, you need some form of X server (honestly, I'm not entirely sure what an "X server" is, but using one works). There are a couple of free options, but I'm going to focus on Xming (we will get to installing the program in a moment). I tried using Cygwin X, another X server program, but found the documentation and options a bit overwhelming and confusing. I thus abandoned Cygwin X for the much simpler Xming (simpler in terms of installation, at least). If you would like to add instructions for alternative server installations, feel free to do so. This is intended to be a living document.
In this section, I will provide a step-by-step for installing the Xming program, which will act as our X server. Conceptually, it "looks" for graphical output from a Linux command (which WSL won't understand) and converts that output into something Windows can display.
Congrats! That was probably the hardest part of this entire exercise.
Now what we are going to do is make sure that sure that our X11 Server is properly configured to work with WSL. This means configuring our display.
bashrc
file, which is loaded every time WSL is loaded (as far as I can tell). To do this, first make sure you are in your home directory, where the .bashrc
file is located:cd ~
.bashrc
file exists by looking for it with the following command: ls -a
.bashrc
file on the third line of the output, so I know I can edit it..bashrc
file with the following command:echo "export DISPLAY=localhost:0.0" >> ~/.bashrc
.bashrc
file before writing to it, so we don't have to worry about overwriting anything.That's it!
Now we are going to test our X11 connection locally. To do that we'll download some extra X11 applications to run.
sudo apt-get install x11-apps
sudo
: This means either "superuser do" or "substitute user do". In essence, it is telling Linux your are running a command as a person of authority (e.g., an administrator).apt-get
: "apt" is an acronym for "Advanced Package Tool". If you are familiar with R, it is kind of like using CRAN, but for Linux programs. "get" means you are telling apt
to either install or upgrade a package.install
: Install a package.x11-apps
: A bunch of X11 applications, which we are going to use to validate our X server is working properly.xeyes
Note: While Xming is running you cannot do anything in WSL's terminal. That is, before you can execute any other commands, you have to exit out of xeyes
by clicking the "X" in the upper right hand corner of the pop-up window.
xclock
Note: In this case you may get en error in the terminal to the effect: "Warning: Missing charsets in String to FontSet conversion". As far as I can tell, this warning is harmless.
Alright, so now that we've successfully installed, configured, and tested Xming on our local machine, let's see if the setup works with Teton.
ssh -X <username>@teton.arcc.uwyo.edu
srun --pty --account="<your project goes here>" -t 0-00:30 /bin/bash
firefox
module load r/3.5.1s
data("mtcars")
plot(mpg ~ hp, data = mtcars)
SWEET MAMA JAMA, IT WORKED!
You now have X11 forward setup for use with WSL.
Here are the main websites I used to develop this tutorial.
The content by label feature displays related articles automatically, based on labels you choose. To edit options for this feature, select the placeholder below and tap the pencil icon.
|