For Assignments 2 through 6, we will use the SEAS cloud infrastructure, developed by the SEAS Academic Computing group. This infrastructure allows users to create, connect to, and shutdown virtual machines (VMs) from a set of pre-specified VM image templates.
If you are looking for information about version control, or using GIT, or the SEAS Code Repository, go to the Version Control Software page.
The rest of this document provides instructions on how to use the SEAS cloud infrastructure for CS 61.
Quick start/summary
This is a brief summary of the instructions. If you are confused, please scroll down for full instructions.
- SSH to
cs61-login.seas.harvard.edu
, using your FAS username and password (see below for instructions if you're not familiar with SSH). - Load the SEAS cloud infrastructure package by running
module load packages/seas-cloud
. - Register on the SEAS cloud infrastructure by running
seas-cloud register
. (This only needs to be done once ever.) - See the templates you can use to create VMs by running
seas-cloud templates
. - Create a VM by running
seas-cloud create
ImageId
, where ImageId is the appropriate identifier for the CS 61 VM template for the assignment. (You will generally only need to create one VM per assignment, and leave it running for the duration of the assignment. It will take about 5 minutes to launch your VM. You can check the status of your VM by runningseas-cloud status
.) - Connect to the VM by running
seas-cloud connect
VMId
where VMId is the identifier of the VM you created.
Logging on
To interact with the CS 61 cloud infrastructure, you must first login to
cs61-login.seas.harvard.edu
, using your FAS username and password. If
you do not have a FAS account, go to
http://www.fas-it.fas.harvard.edu/accounttools
and create a FAS account.
You can login to the machine using your favorite ssh
client. On Linux
and on Mac OS X, ssh
is usually available by default. Just use the
ssh
yourUserName
@cs61-login.seas.harvard.edu
. On Windows, we
recommend using
PuTTY.
Even though you use your FAS credentials to log on to the
cs61-login.seas.harvard.edu
machine, your FAS home directory will not
be available to you. Instead, you will have your own CS 61 home
directory. This home directory will also be your home directory when you
connect to a CS 61 virtual machine that you create.
Using the SEAS Cloud Infrastructure
After connecting to cs61-login.seas.harvard.edu
, execute the command
module load packages/seas-cloud
. This sets up your environment to use
the SEAS cloud infrastructure, for example, setting enivironment
variables
correctly. This command needs to be run every time you log on to
cs61-login.seas.harvard.edu
. You may want to put this command in your
.bash_profile
file.
-bash-4.1$ module load packages/seas-cloud
The command-line tool seas-cloud
provides the ability to create
virtual machines (VMs), connect to VMs you have created, and shutdown
VMs you have created. Execute seas-cloud help
to view the
documentation for this tool.
-bash-4.1$ seas-cloud help
You must register your account with the SEAS cloud infrastructure.
Execute seas-cloud register
. This command only needs to be performed
once.
-bash-4.1$ seas-cloud register
Starting a VM
You can list the available VM image templates by executing
seas-cloud templates
.
-bash-4.1$ seas-cloud templates
ID USER GROUP NAME REGTIME PUB
34 oneadmin users SEAS CentOS 6 Base 08/15 18:11:13 Yes
36 parrott users SEAS Virtual Remote Desktop (B 08/24 15:14:59 Yes
37 oneadmin users SEAS Linux 6 Base 08/26 07:24:33 Yes
38 oneadmin users CS61 Course VM 08/26 08:35:42 Yes
You can start a new VM by executing seas-cloud create
ImageID
,
where ImageID is the identifier of the template you would like to use
to create a VM. The CS 61 VM image is has id 38.
-bash-4.1$ seas-cloud create 38
ID: 781
It may take 5-15 minutes to start a VM, as this involves making a copy
of a disk image. You can check on the status of your VM by executing
seas-cloud status
. To begin, the VM will be in the "pending", or
pend
state. It will then transition to the "prolog", or prol
state
(when it is copying the template disk image to create your VM). It will
then transition to the "running", or runn
state. If there's an error,
it may end up in a "failed" or fail
state.
-bash-4.1$ seas-cloud status
ID USER GROUP NAME STAT CPU MEM HOSTNAME TIME
781 stephenc users CS61 Course VM prol 0 0K arc-vm-4 00 04:53:35
We recommend that you start a VM at the beginning of each assignment,
use that VM for the duration of the assignment, and shut down the VM at
the end of the assignment. Any files you create in your home directory
on cs61-login.seas.harvard.edu
will be on any VM you create, and
vice-versa.
Connecting to a VM
Once the VM is in a running state, you can connect to it by executing
seas-cloud connect
VMId
command, where VMId
is the identifier
of the VM you started.
-bash-4.1$ seas-cloud connect 781
Once you have executed this statement, you will be logged onto the VM you have just created.
Shutting down a VM
To shutdown and destroy a machine, execute
seas-cloud destroy
VMId
, where VMId
is the identifier of the
VM you want to shut down. This command will shutdown and delete the VM
disk image, and all local data on that VM image. However, files in your
home directory will remain untouched, and will be available to you on
cs61-login.seas.harvard.edu
and any other VMs you create.
-bash-4.1$ seas-cloud destroy 781
Your home directory
The machine cs61-login.seas.harvard.edu
, as well as all CS 61 VMs you
launch, mount a shared home filesystem, and have a consistent set of
shared home directories. This means that you have the same home
directory on all of the machines you log on to for CS 61. Thus, work
saved in your home directory on a VM can be accessed from
cs61-login.seas.harvard.edu
or any other CS 61 VM you create.
Extra for experts
File transfer
To get files to and from your CS 61 home directory, you can use scp
(Secure Copy). On Linux and Mac OS X, scp
is usually available by
default. For example, to copy the file test.txt
from your local
directory (say, on your laptop) to your CS 61 home directory, you could
run the following command.
$ scp test.txt YourUserName@cs61-login.seas.harvard.edu:
On Windows, we recommend using WinSCP to move your files to and from your CS 61 home directory.
Connecting to a VM from outside cs61-login.seas.harvard.edu
The easiest way to connect to a VM you have started is to log on to
cs61-login.seas.harvard.edu
and then to use the command
seas-cloud connect
. You can, however, ssh
directly to your VM from
another computer.
First, you will need to be behind the Harvard firewall to connect directly to your VM. You may need to run the FAS VPN tool to establish a VPN connection to Harvard.
Second, you need to find the IP address of your VM, using the
seas-cloud showip
command.
-bash-4.1$ seas-cloud showip 781
10.243.28.40
Third, you need to print out your private key using the
seas-cloud mykey
command:
-bash-4.1$ seas-cloud mykey
-----BEGIN RSA PRIVATE KEY-----
MII......
-----END RSA PRIVATE KEY-----
Copy and paste that key from the terminal into file on your client
machine, setup the correct permissions (chmod 400 the.key
on Mac or
Linux) and then connect using that key. For Mac or Linux, this would be,
from the command line,
$ ssh -i the.key username@10.243.28.40
To forward X connections, use the -Y
option to ssh
:
$ ssh -Y -i the.key username@10.243.28.40