Quick and Easy? MobaXterm

Before reading below, MobaXterm (https://mobaxterm.mobatek.net/ probably offers most, if not all, of the necessary unix-like functionality on Windows machines for this course. It allows you to connect to remove machines, like alfven.physics.mun.ca, and also has an linux environment for which you can install necssary software. There is a free, portable version available for download. It also has a built-in X11 server that allows graphics to come in from remote machines and from any WSL-ubuntu installation you may wish to later add to your Windows computer. Try it out! If you do, once you run it, under Settings | Configurations, you can choose where your MobaXterm hoome directory resides on your machine. I have not vetted MobaXterm with what we do with the course, but it seems to be functional enough to start.

Ubuntu on a virtual machine in Windows

We will be working in a Linux environment, and it is essential that you get this running on your machine. I suspect that most of you have a Windows operating system, but the good news is that Windows 10 allows you to do this through WSL, the Windows Subsystem for Linux.

So for those of you with Windows, I would strongly suggest installing Ubuntu Linux through WSL, and also installing an X11 server that allows graphical output from a Linux installation. I typically do not use Windows, but below I have outlined the steps that I took to get this working on a pretty new Windows laptop (2020) we have in the home running Windows 10.

If you have a Linux system, then you are mostly set. Just read through below and install the software mentioned (e.g. graphing programs and compilers) if you don’t already have them installed. You don't have to worry about installing an Xserver.

If you use macOS (which is built on top of unix-like foundation), then you will need to install Xcode, along with Command Line Tools. You will also need and X11 windows server like XQuartz (https://www.xquartz.org). Homebrew (https://brew.sh) provides a way of installing linux tools, like ‘wget’, ‘grace’, and 'gnuplot', with commands like 'brew install grace'. I also suggest that you install a Latex editor, such as TeXShop, described at https://pages.uoregon.edu/koch/texshop/, where under the menu heading Obtaining you will find a link to download the installer in the section "Obtaining TeXShop and TeX Live" that installs everything you need: MacTex.pkg. After all these installations, you should be set up.

For Windows 11, I have not tried installing Ubuntu, but it should be fairly straightforward. Famous last words! When I googled, I got a reasonable hit https://ubuntu.com/tutorials/install-ubuntu-on-wsl2-on-windows-11-with-gui-support#1-overview. Good luck! When you manage to install Ubuntu, skip down a few steps to the one with `sudo apt update`. If you are having trouble, we will sort it out!

Ok, so Windows 10 users, you could google 'install Ubuntu on Windows 10’, which is pretty much what I did, or try to follow my footsteps outlined below.

Go to https://ubuntu.com/tutorials/ubuntu-on-windows and follow instructions. I bought the x86 laptop later in 2020, so it was up-to-date with Windows 10 software.

For Step 3, I had to open Windows PowerShell, which I found through the start menu in the bottom left corner. I had to run it as administrator (by first right-clicking on it in the start menu).

Step 4 does require a download.

After finishing, and when running Ubuntu for the first time, enter

sudo apt update
then (some of the installs below take a while. Sometimes the installation will pause and there will be a prompt like Add all these libraries [Y/n]? The capital Y indicates that the default is "yes", so you can just press enter.)
sudo apt install grace
sudo apt install gfortran 
(this will also install gcc)
sudo apt install g++
(optional) sudo apt install gnuplot-x11
sudo apt install xeyes
Note, to copy and paste text within Ubuntu on WSL, select text by dragging with left mouse buttom, then right-click to copy text, then you can paste with another right click (or ctrl-v if pasting into another window).

Then, for Windows 10, I downloaded VcXsrv from https://sourceforge.net/projects/vcxsrv/. This is to allow ubuntu to display graphics. For Windows 11, WSL2 should come with WSLg, a graphical package, by default, and so installing something like VcXsrv should not be necessary.

and installed it by double-clicking the installer file. I just went with all the defaults. I then started it from the Start menu (VcXsrv/XLaunch) and chose to start using "multiple windows", "Display number" set to 0 (zero, not -1, although zero is what it defaults to, so on my machine, changing from "-1" to "0" is not really necessary), with no client, and whatever it defaulted to in the last step.

Back in the ubuntu shell, which you can always find in the start menu as "Ubuntu", enter

xmgrace
This should fail, because the shell does not know where to send graphical output, so enter.
export DISPLAY=0.0
and try xmgrace again. A window should appear with part of a set of axes showing. The "export" command set the DISPLAY variable so that graphical output knows where to go. Close the xmgrace window.

If graphical output is not working, and you are getting a "can't open DISPLAY" kind of error, instead of the previous export DISPLAY command, try

export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
and you may also need to run VcXsrv with "-ac" filled in the line of "Additional parameters" (on one of the screens that you go through when opening VcXsrv).

So that you don't have to do this each time that you launch Ubuntu, enter

nano .bashrc
"nano" is a text editor, with menus indicated at the bottom of the terminal. The "^" before a character indicates that you hold down the Ctrl key while pressing the indicated letter.

Go down to the bottom of the file with the down arrow key and on a new line enter

export DISPLAY=0.0
or
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
(whichever worked for you earlier) then press Ctrl-o and the “enter/return" to keep the file name the same, and then ctrl-x.

Now the next time you open Ubuntu and XLaunch, graphical output should work.

The nano editor is simple and light-wieght. You can use it to edit files when remotely accessing another machine. There are many text editors, including classics like vi and emacs (learning curve is a little steep for these). An easy-to-use graphical one is "gedit", which you can install with

sudo apt install gedit (this one takes a while!)
Might as well install these other packages as well
sudo apt install texlive-latex-base
sudo apt install make
sudo apt install ghostscript
sudo apt install gv
sudo apt install evince
(evince is a pdf reader)
sudo apt install gummi
(gummi is nice Latex IDE)

So have a crack at it. Please don’t feel stressed about it, and feel free to email if you have any questions. If things aren’t working out, we'll figure it out… and there will be time next week to work out the kinks.

Physics 3800 - Connecting from home

Under Linux, MacOSX or Windows you will want to connect to alvfen.physics.mun.ca. From a terminal in Linux (Ubuntu shell in Windows) or MacOSX, at a terminal type
ssh -X username@alfven.physics.mun.ca The -X enables X11 forwarding (for graphics). For Windows and macOS, you will need to have the X server running to get graphical display.

One thing to keep in mind when using X11 over the internet is that it's slow. Very slow.