The CSE Lab prepares a virtual machine image - a "home VM" - that approximates the computing experience of an instructional Linux box at school that you can run on your desktop or laptop wherever you are. This document explains how this works, and what you need to do in order to use this software.
What’s a "Linux Home VM" and why do I want it?
Virtual machines - see https://en.wikipedia.org/wiki/Virtual_machine - are emulated computer instances running inside a special program you install on your desktop or laptop computer. The virtual machine can run a completely different operating system than its host - for example, you could run a Linux or a Windows 10 virtual machine on your Macintosh laptop, or a Linux virtual machine on your Windows machine.
A number of our courses have programming projects that require the use of a Linux host to complete. A virtual machine affords you the option for working on these projects on your own device, anywhere in the world.
The "Linux Home VM" we prepare runs the same underlying operating system - CentOS 7, as of Spring Quarter 2017 - and the same software packages as are installed on our instructional Linux hosts on campus (the "attu" hosts, for example).
How Does It Work?
Virtual machines run inside some other program. There are numerous applications, on most platforms, that fulfill this need. We offer access to download VMware Workstation (for Windows) or VMware Fusion (for Macintosh) free of charge to students enrolled in CSE courses that require the software. There are many others - Virtualbox, Parallels, KVM, and Docker, to name a few - but for the purposes of this introductory document, we’ll assume you are using one of the VMWare products.
OK, You’ve sold me. How do I do this?
Four steps: get the software and install it, get the VM and unpack it, start up the VM, and personalize it.
- Install the emulator software. CSE Majors and non-majors enrolled in CSE courses requiring the VM should already have access to CSE's VMWare Academic Program site, where you can download VMWare products for free. If you are not able to log in, please request an account by emailing support@cs, including your UW NetID username and detailing why you need access. When you have that, you can download the software for your computer - VMware Workstation for the Windows platform, or VMware Fusion for the Macintosh - and install it. (Note to Windows users: do not download and install VMware Player 7; it's out of date and won't run our virtual machine image.)
- Download our "Linux Home VM" image. This is a large (between 3.5GB and 4.0GB) gzipped TAR file or ZIP file that, once downloaded and unpacked, has all of the files necessary to run our “home VM.” Create a new folder and put the TAR or ZIP file inside it, and then move into that folder and unpack it. You’ll have six new files.
- Start the "Linux Home VM" instance. Start the VMware product you installed in step 1, and select "Open a Virtual Machine" from the "File" menu. Select the file that ends in ".vmx" in the folder you created in step 2. Select "Run" from the "Virtual Machine" menu, and when you are asked if you moved or copied the file, answer "Yes, I copied it."
(Note: If you are installing the new ("18wi") VM, you may need to set the Guest Operating System to "Linux" and the Version to "CentOS 64-bit" in the settings. Right-click on the VM name in the Virtual Machine menu and select "Settings" to make this change.)
Personalize your VM instance. When the VM has launched, select the "A. Happy User" button in the center of the screen. There’s no password associated with that account; it’s there solely to get you started. Once you are logged in, select the “terminal” icon in the upper right corner of the toolbar. Its “tool tip” says "Setup User."
You will first be asked for a password for the "root" account on the VM. You’re going to want to remember this password, as you will be required to type it in whenever you perform maintenance on the VM.
Next, you will set up your user account on the VM. If you’re a CSE student, use your CSE username, and select a password for this account. (This will not change your CSE password anywhere else, it’s just for the VM.) If you are not a CSE student, you can use any username and password you’d like.
After setting up your user account, the VM will reboot, and from this point on, use the username and password you just set up to log into the VM.
Tips and Tricks
Files can be moved onto or off of the VM with a "drag and drop" action in the GUI, or with one of the following programs running on the VM: "scp" or "rcp" or "sftp."
If you have one, your CSE home directory can be mounted on the VM with these instructions:
- In your VM, in a terminal (shell) window, type this command:
cd; mkdir csehomedirwhich creates a folder in your VM's home directory called "csehomedir." You only need to do this once.
- In your VM, in a terminal (shell) window, type this command:
sshfs attu: ~/csehomedirto establish a connection between your VM and your CSE home directory on "attu.cs.washington.edu." This does assume that your VM is running on a host with network connectivity.
- If you then type
cd csehomedirinto the terminal window, you should see your CSE home directory, and can use "mv" and "cp" to transfer files back and forth.
- If you want to disconnect "csehomedir" you should make sure you are not in that directory on your VM - type
cd; fusermount -u ~/csehomedir.
If you'd like to mount your UW ("U: drive") home directory, there are two methods. You'll be asked for your UWNetID credentials during either process.
(1) You can mount the U drive as a file system. Note that this method will only work if you are connected to a UW network or are using the BIG_IP/OnNet client. At the present time (Oct. 18, 2017) there is no BIG_IP/OnNet client available for Linux.
cd; mkdir ~/udrivewhich creates a folder in your VM's home directory called "udrive." You only need to do this once.
sudo yum install cifs-utilsto install that Linux packages. You only need to this once.
grp=`id -gn`; sudo mount.cifs //udrive.uw.edu/udrive ~/udrive -o domain=NETID,uid=$USER,gid=$grp.
cd; sudo umount ~/udrive.
(2) You can use SFTP.
The SFTP client is installed by default on the VM and provides an FTP-like
get/put command interface to file transfer. To make a connection use the following command:
You will be prompted for your UWNetID password. See the sftp manual page for further instructions.
Updating the VM
Keeping your VM’s software packages up to date is your responsibility. This is a CentOS operating system, and the appropriate command to update all installed packages is
sudo yum update. You’ll be asked for your password (the one you set when you established your user account on the VM) before this command will run.
If you want to install a package, and know its name, you can type
sudo yum install PACKAGENAME and it will be installed.
Connecting to CSE Hosts
From your VM, you can connect to Linux hosts at school, by first typing this command in a terminal window -
kinit - to obtain Kerberos credentials, and then
ssh attu.cs.washington.edu and, once the connection is established, typing in your Kerberos password at the prompt. To obtain a connection with X11 forwarding type
ssh -Y attu.cs.washington.edu.
Recovering A Broken VM
If you find that your virtual machine's configuration has become unstable, you can attempt to recover your VM home directory and environment by following these steps.
- Shut down the VM, and quit the VMWare program (Fusion or Workstation).
- Navigate to the folder on your computer where the VM files were originally unpacked, from the TAR or ZIP file.
- Copy the file that ends in "-homes.vmdk" (example: "homevm-autumn18-homes.vmdk") to a safe location.
- Delete the containing folder.
- Download the VM image file again, and unpack the TAR or ZIP file.
- Replace the file in that new folder that ends in "-homes.vmdk" with the file you previously saved.
- Set up the VM again, starting with step #3 - "Start the 'Linux Home VM' instance."
The file that ends in "-homes.vmdk" is the disk partition that contains your VM's home directory.
If you have questions about how any of this works, or suggestions for software we should add to the VM for future quarters, or think you’ve encountered a bug that you’d like us to fix, send us e-mail email@example.com and we’ll be happy to help.