By Evan Murphy, 4/17/2006. Revised by Mike Vanier, 4/24/2006.
Most CS 11 students do their labs from the comfort and convenience of their own rooms. However, since most people are stuck running Windows, and the CS cluster machines run Linux, there's a problem. If you did your labs on the CS cluster computer, you would get a nice graphical interface to work with. But if you log in remotely to the CS cluster with (say) PuTTY, then all you get is a single terminal. Worse, you can't start up graphical programs, because the graphical interface software on Linux is different from that on Windows.
That being the case, you have these choices:
This document will cover option 3. If you set this up correctly, you will be able to use all the programs that you would have used in the CS lab on your Windows computer. You'll also be able to run multiple programs on the CS cluster at the same time (e.g. a terminal and a text editor) and all of them will show up on your Windows computer. So working on your labs in your room won't be much different from working on them in the CS lab.
If your computer runs Linux already, you don't need this document -- you just need to know this command:
% ssh -X login.cs.caltech.edu
where "%
" is the terminal prompt. If your computer is a Mac,
this document won't help, but I believe there is an X server that works on
the Mac (anyone want to look into this?)
The Linux graphical windowing system is called X11, also known as X Windows, or X for short. Note that "X Windows" has nothing whatsoever to do with Microsoft Windows. Nada. Zip. Zero. Forget I even mentioned it.
"X forwarding" is a feature of X where a graphical program runs on one computer, but the user interacts with it on another computer. If you've ever used VNC or Microsoft's Remote Desktop, it's conceptually like that, but it works on a program-by-program or window-by-window basis.
If both computers are running Linux, it's pretty much transparent. However, if you're sitting in front of a Windows computer, it's a little bit trickier -- not much, though! All you need is an X server that runs on Windows, and an SSH client, both of which are freely available.
In X parlance, the "client" is the computer running the program, and the "server" is the computer you're sitting in front of. This might seem backwards: normally the server is the remote computer that's serving you.
Think of it this way: the X server is serving you, the human being, to the programs on the remote computer. The client, a program, makes requests of you through the X server by changing its graphical display, and you respond to it by clicking on it or typing into it.
I'm going to explain how to do this with PuTTY, a free and very powerful SSH client for Windows. You can find it here.
You don't need to install PuTTY; just put it in a convenient place and run it. You can leave it on your desktop, or put it in "Program Files" and create a shortcut to the program in your Start Menu. Or you can install it if you like.
You can get the standard X.Org X server ported for Windows; it's called XMing. Actually finding the installer files is a pain, so here are some direct links:
You need both of these!
Now, install both these packages. They have nice Windows installers, so this should be pretty straightforward. Make sure that you put both of them in the same directory (it will do this by default -- be sure to say "yes" even though the directory already exists).
You should have a Start Menu item for XMing. Go ahead and start it. If you're using a firewall, it'll ask you if you want to unblock it. You don't need to.
Look for the "X" icon in your system tray. Hover the mouse over it: it should say something like "Xming server - 0:0". The last bit should be "0:0", but if it's not, pay attention to that and use it below.
I'm assuming you're currently using PuTTY. If not, there's some good documentation on the PuTTY website. It's also very easy to use, so you should be able to start using it without much trouble anyways.
First, open PuTTY. Then, put in your normal settings for connecting to the CS cluster: under host name, put "your-username@login.cs.caltech.edu".
Then, on the left, click on the Connection/SSH/X11 sub-panel. It'll have a few options. Check "Enable X11 Forwarding", and in the "X display location", put "localhost:0:0" in the box (unless you didn't have "0:0" in the section above: then use "localhost:x:y", where "x:y" is whatever you saw on the icon). Leave the radio button on "MIT-Magic-Cookie-1".
Now click back to the main "Session" panel on the left. Put a name (like "CS + XWindows") in the text box in the middle right below "Saved Sessions". Click the "Save" button. From now on, you can double click the connection in the list box when you want to connect to CS; you don't need to do these settings every time.
Press "Open" to start PuTTY. Put in your password or do whatever you do to authenticate. Now run the command "xeyes &". You should get a big pair of googly-eyes that follows the cursor around. It works!
It's important to start the XMing server before you try to start the graphical program you want to run. Otherwise, there won't be anything on your end to draw the windows.
You can put an ampersand ('&') after any command to make it go to the background: i.e. "emacs &" will start emacs and let you continue to use the PuTTY terminal.
Any programs you start in this way will close (and lose your work!) if you close the PuTTY session. So don't do that.
If you need another terminal, instead of running another PuTTY session, try running "xterm &" in your current session. This will create a terminal using the CS cluster's terminal program, and display the window on your computer.
You can run any program that you'd start as if you're sitting in front of one of the terminals in the CS lab. Unfortunately, they're not always installed on login.cs. You can SSH to another computer (try e.g. pacman.cs or pong.cs) if that's the case. Try "mozilla-firefox &", for example. NOTE: In general, you shouldn't be running graphical applications on login.cs anyway, because they often use a lot more computing power than their non-graphical counterparts, and login.cs is not an appropriate computer on which to run computationally-intensive programs. Please keep this in mind.
Very graphics-heavy programs (like, ahem, "mozilla-firefox") may be somewhat slow. Be patient if you're on a slow connection; everything will work eventually. Terminals and editors should be reasonably fast, and that's all you need for most CS 11 tracks.
If you have any questions about this document, please don't hesitate to contact us!