Remote X Tutorial

In this class, we're using the open source, UNIX-like operating system known as Linux for all of our development. For most, the transition from developing in Visual Studio or Eclipse to developing in UNIX is rough, at best. All of a sudden, you have to learn a slew of new commands just to be able to access your files, and on top of that, you have to learn the ins and outs of a new editor, Emacs. While it's helpful to go to the cluster and work directly on the machines using Emacs in a graphical window, it isn't always convenient. In this tutorial, I'll explain how to bring the UNIX environment on Stanford's machines to your own computer, as if it were running natively on your computer. That way, Emacs will appear as another window on your screen, just as if it were a graphical word processor on your system. The steps I detail are cleaner and faster than VNC, an alternative way of connecting to Stanford's machines graphically. Obviously, you still have to learn the UNIX commands, but this will definitely make your life a bit easier. Feel free to stop by my (Ryan's) office hours anytime if you run into trouble with these directions.

The basic idea of what we're doing is as follows. In UNIX, graphical applications are commonly run on top of a system known as X. X was designed for a "client/server" model which means the computer that stores and runs the application does not have to be the same computer that is displaying the application to the user. In this tutorial, we will show you how to run a UNIX terminal from a Stanford cluster computer on your very own machine. This terminal can then be used to explore your code and launch your editor (here we use Emacs).

Note that in this tutorial I assume you're using the 'myth' cluster of workstations. These are the workstations located in room B08 of the Gates basement. The Myth machines are a personal favorite of mine due to all of MY happy 107 memories, but these instructions also work for the other farmshare computers such as 'corn' and 'barley'. To use an alternate cluster, simply substitute its name wherever you see 'myth'.

To begin, select your operating system.

  • Windows
  • MacOS X
  • Linux (any flavor)

Windows XP/Vista/Win7:

Here we will download and install an open source program known as Xming, which is an implementation of X for Windows.

  1. Click here to download the installer for Xming.
  2. You should be able to run through the installer with the default values. At the end it should summarize the install like this: 
     
    Click install and let it do its thing.
  3. After it's done, it should have created an entry for 'Xming' in your Start menu. Go into the folder and click 'XLaunch' to bring up the wizard that will let you create a shortcut to launch the remote terminal.
  4. Select the default 'Multiple windows'
  5. On the next screen, select 'Start a program'
  6. Next, type 'gnome-terminal' (yes...gnome) as the program to start. Then select 'Using PuTTY (plink.exe)'. Enter 'myth.stanford.edu' as the computer to connect. Finally, type your SUNet ID (ie jsmith) with your password. (XMing won't accept a password longer then 14 characters here, but just leave the password field blank, and you will be able to type it in later when you launch.) Then click next.
  7. The next screen should look like the picture below. Just click next.
  8. On the next screen, click 'Save Configuration'. In the window that pops up navigate to your desktop and type the filename 'myth.xlaunch' as shown in the picture. Then click save and finish the XLaunch wizard. Notice that it has placed a shortcut to launch the remote terminal on your desktop.
  9. For some people, Xming will launch itself and start running in the background after the installer completes. If this is the case, launching the shortcut will ask you for your password and then do nothing. Before going on to the next step, ensure that there is not a little black and orange X in the system tray at the bottom right of your screen.
  10. Launch the shortcut ('myth.xlaunch') on your desktop. It should probably ask you for your password again. Enter it and after a few seconds a terminal something like the one below should appear.
  11. Congratulations! You've got your spiffy new remote X terminal working. Please proceed to the section entitled 'What to do with your shiny new X Terminal'.

MacOS X

The cool thing about OS X is that it's build on UNIX. That's right...all of you cool Mac people are already even cooler UNIX people and you probably didn't even know it! Because of this, it's pretty simple to get X working on MacOS X.

  1. If you don't already know, check what version of OS X you're running by clicking the Apple menu and selecting 'About This Mac'.
  2. The good news is, if you're running 10.5 (Leopard) X most likely was installed by default when your operating system was installed. You can open the Terminal from Applications/Utilities and skip to Step 3. If you're running 10.4 (Tiger) then follow the directions here and afterwards launch your X terminal by opening 'X11' from Applications/Utilities. Continue on to step 3 with the 'xterm' window that shows up in place of the standard OS X Terminal.
  3. By this point, you should have an X enabled terminal in front of you. Now we're going to log into a Stanford machine. Type 'ssh -Y [email protected]' (without the quotes and with your SUNet in the right spot). The picture below gives the general idea. Type 'yes' if asked to accept a public key (this connection is encrypted!) and type your password when prompted (don't worry if nothing shows up on the screen when you type your password).
  4. Congrats! You've logged in. Please proceed to the section entitled 'What to do with your shiny new X Terminal'

Linux

If you're already running Linux (hooray for you!) then it's super easy to remote into Stanford's machines.

  1. Open up a terminal (in Ubuntu/Debian it's under Applications/Accessories).
  2. To log into Stanford's machine, just type 'ssh -Y [email protected]' (without the quotes and with your SUNet in the right spot).
  3. Type 'yes' if asked to accept a public key (hooray for encryption!) and type your SUNet password when prompted (don't worry if nothing shows up on the screen when you type your password).
  4. Your whole session should look something like this:

What to do with your shiny new X Terminal

Now, by whatever method, you've got a fully functional X enabled terminal in front of you. Here you can do all of the UNIX commands for moving around the computer and running programs.

  1. Type 'xcalc&' (with the & at the end) to open a simple calculator. The '&' at the end tells a program to run in the background. This is useful if you're running a graphical application as it gives you back control of the terminal after the application opens.
  2. The picture below illustrates how to open Emacs, a powerful but not entirely intuitive text editor for coding. To open a file named 'myfile.c' in emacs just enter the command 'emacs myfile.c&'.
  3. Emacs launched in this way looks something like this (depending on your OS).
  4. That's it! Look back on the main site for further documentation of Emacs and the bountiful joys of coding in UNIX!

你可能感兴趣的:(Remote X Tutorial)