Computing Resources


Printer-friendly version

Running Server and Workstation Applications Remotely


Applications on the linux workstations and compute servers in Math & Stats can be run remotely: that is, you can connect to one of these computers from your desktop or laptop and run applications such as R, Maple and SAS.


Summary

You can connect in one of two ways:
  1. login with ssh (for text-only programs) or ssh + X11 for graphical programs
  2. connect with Virtual Network Computing (vnc) software to run a complete remote desktop

If you are running linux or a Mac, you will already have ssh and X11.  Windows users will need to install software for ssh and X11.  This used to be fussy, but a newish program called MobaXterm included both ssh and X11 and comes in a version which may be downloaded for free (see below).

VNC software is described below.

Some Preliminary Notes

Working from Off-Campus or Eduroam

If you are not on campus, then you will first need to make make a Virtual Private Network connection in order to be able to connect to on-campus workstations and compute servers; the same is true if you are using Eduroam wireless (Eduroam is, effectively, outside of the McMaster network).

You use your MacID to login to the VPN service. The UTS website has Cisco VPN clients for Mac OS X, Windows and linux.

Speed

Remote graphical connections can be a little bit laggy sometimes.  Using the text/consolve versions is generally the most nimble way to use remote apps - e.g. R (this is the default), MATLAB (matlab-console) or Maple (maple instead of xmaple).

Graphical applications running over ssh + X11 will be a little bit slower when run from a remote computer.   A VPN connection (required for off-campus use) will slow things down even more.  

The VNC connections are generally pretty responsive, though setting up a VNC connection takes a bit of getting used to.

Local Disk vs. Network Disk

When you login to one of the compute servers or workstations, you see the files in your home directory on ms (the main server).   If you are going to run jobs which take a long time, which use files larger than 100Mb, or which read/write data frequently, you should use a disk on the server or workstation itself: this will protect you from problems connecting to the main server, will reduce strain on the main server, and will speed your jobs up (since local I/O is generally faster than network I/O).

Most servers and workstations have a local disk mounted at /1.  You will find two directories which belong to you:
  • /1/home/username
  • /1/scratch/username
Files in /1/scratch are not backed up; this is a good place for scratch/temp files which you won't need for very long.  Files in /1/home are backed up overnight.

Screen

If you have a long running program (incl. MATLAB, Maple or R jobs), you should use the screen utility. Jobs running in screen sessions will continue to run even if you disconnect from the server and you can reconnect to the sessions again later (from any computer).

For example, here's how you can start an R session from your office and the reconnect to it from home ...

From your office:

ssh bayes
screen -a
R
<crtl>-a d
logout

From home:

ssh ms.mcmaster.ca
ssh bayes
screen -r

... and there you are back at the R prompt. If you had set an R command or script running, it will have continued running in the background.

Note that above assumes that 1) you are using a terminal application in OS X or linux, or MobaXterm in Windows and 2) that your local username is the same as your ms username; see below for details.

Usernames and Computer Names

If you have the same username on local computer on as you do on the remote host, then you don't have to specify your username when you ssh in: for example, you can use ssh bayes.mcmaster.ca rather than ssh jhsmith@bayes.mcmaster.ca.

If you are on campus or connected via a VPN, you will probably need to specify on the first part of a hostname in order to connect to it.  That is, you can use ssh bayes instead of ssh bayes.mcmaster.ca.

Using ssh keys for password-free ssh connections

If you use ssh a lot, typing your password every time can be tedious; using an ssh-key file lets you type your password once per login session.  See  Using SSH without a Password.

OS X & Linux

Using ssh and X11

Running Maple on a remote host under OS XYou simply need to open a Terminal or X11 xterm window (under Applications -> Utilities -> Terminal in OS X) and login to the remote host via ssh; you can then run your application. 


For example, to run R - a text-only application - on bayes.mcmaster.ca as user yfchen:

ssh yfchen@bayes.mcmaster.ca
R

To run matlab - in graphical mode - on bayes.mcmaster.ca as user yfchen:

ssh -XC yfchen@bayes.mcmaster.ca
matlab

On Ubuntu and some other distributions which have X11 Forwarding disabled by default, you will need to use "ssh -X".   Over slow network links (i.e. from off campus), use "ssh -C" to compress the graphical data (less data will be transferred, but both your computer and the remote computer will have to do a little more work).

Using VNC

AVNC client will display a complete desktop from the remote computer, including menus and desktop icons - just as if you were logged into one of the desktop workstations in Hamilton Hal.  A good client for the Mac is Chicken of the VNC; for linux, there are many, including Vinagre

Making a VNC connection is a two part process: 1) start the VNC service on the remote computer and 2) connect to it using the VNC client software.

1) Start the VNC service on the remote host

  1. ssh to remote host
  2. set a vnc password on the remote host (you only need to do this the first time you run VNC)
    vncpassword
  3. run vncserver on the remote host and note the port number it's running on
    vncserver
2) Connect to the vncserver processes
  1. run your VNC client and connect to the host you ssh'ed to; note that you will need the Port Number for Chicken of the VNC - it will be 1, unless vncserver tells you otherwise
  2. when done, run this on the remote host
    killall -9 Xvnc

Microsoft Windows

Windows does not come with either ssh or X11 graphics built in.   There are a few options:  a combined ssh and X11 client; an ssh client plus an X11 client; a virtual linux computer running under Windows.  The first option is simplest

Text-Only Applications

Running Maple via PuTTY ssh under Windows 7Things are fairly simple if you want to run text-only applications such as R or the console versions of Maple or MATLAB (maple, matlab-console): you just need an ssh program.  PuTTY SSH (limited to text-only sessions) and MobaXterm (can do both text and graphical connections) are both free and easy to use. 

Graphical Applications

If you want to run the graphical versions of such packages of Maple or MATLAB, there are three general approaches:
  1. use ssh and X11 software
  2. use Virtual Network Console (VNC) software
  3. run a virtual linux computer

Use ssh and X11 Software

MobaXterm allows you to connect to remote computers and then run either commandline or graphical applications.  Download the free version from ...
http://mobaxterm.mobatek.net

Then open the .zip file and save the single executable file to your it to your Desktop or other folder; double-click to run it. You can then connect to remote hosts just as you would from an OS X or linux terminal.  For example, to run MATLAB on bayes.mcmaster.ca as useryfchen:

ssh yfchen@bayes.mcmaster.ca

matlab

Use Virtual Network Computing (VNC) Software

Maple running on a remote host via TightVNC under Windows 7Another approach to running ssh and X11 is to run a VNC server on the remote system and use a VNC client on your Windows computer.  A good free client is TightVNC.  To run a remote desktop using VNC:
  1. ssh to remote host
  2. set a vnc password on the remote host (you only need to do this the first time you run VNC)
    vncpassword
  3. run vncserver on the remote host and note the screen number and port number it's running on
    vncserver
    vncserve-info
  4. run a VNC viewer and connect to host, specifying either the port number or screen number (some viewers will request one, some the other)

Run a Virtual Linux Computer

Maple running remotely via an Ubuntu linux virtual machine running under Windows 7If your computer has plenty of RAM (say 4Gb or more) and lots of free disk space (at least 30Gb), then you can run a virtual linux computer under Windows: this way, you can just use the linux instructions above.  VirtualBox is a good free VM platform.  The latest version of Ubuntu linux is easy to install.  Here are instructions from another site for Installing Ubuntu inside Windows using VirtualBox.