Contact Information

Bookware: VM instructions


Options for getting and using the bookware

  1. Download a VM image compatible with the free VirtualBox software (for Intel-based Macs, Windows PCs, or Linux computers). This option is completely free, thanks to support from edX for hosting the image file.  (Google and Microsoft supported this previously…thank you for helping us launch!)
  2. Use Amazon Elastic Compute Cloud to deploy the VM image in the cloud:
    • The Amazon Web Services Free Tier gives you 1 year of access to a Micro instance, which is sufficient to do the coursework, but may be sluggish. 
    • You can pay per hour (from $0.03 and up) to get a dedicated Small instance, which would be faster. To use this option you must have your own Amazon Web Services account.
    • If you are using this book in a course, your instructor may be able to get a donation of AWS educational credits from Amazon and allocate some of those to you.  (We have no connection to Amazon and cannot secure donations for you.)
  3. Start from a free "bare bones" Ubuntu image and run our setup script to install all the courseware. There's no point-and-click here—you must be comfortable using Unix command-line utilities and troubleshooting the error messages that might appear. The setup script is in the GitHub saasbook/courseware repo and is tagged with the version number of the earliest book version with which it's been tested.

Which version of the VM should I use?

Book version VM image to download and deploy on VirtualBox hypervisor) Amazon AMI ID (see instructions below)  Notes/Errata
< 0.10.0 (Beta Edition)Downloadable VM no longer availableami-b1597ef4 (Region: us-west-1, N. California)Adds Guest Additions and RottenPotatoes pre-included.  Release also runs chmod -r +r /usr/local/lib/ruby/gems after setup
 0.10.0 - 0.10.2 (Second Beta Edition)

saasbook-0.10.3.1.zip

ami-b97b2cd0 (Region: us-east-1, N.Virginia)

Update to Ruby 1.9.3, Rails 3.2.16, many new gems, libraries and tools that are introduced in book version 0.10.0 and later
 0.10.3 saasbook-0.10.3.1.zip ami-db655cb2 (Region: us-east-1, N. Virginia)
ami-803c5fb0 (Region: us-west-2, Oregon)
Coming Soon: 1-click Amazon CloudFormation setup
New gem themoviedb replaces ruby-tmdb;  rspec-rails gem added to install; cucumber-rails-training-wheels gem reinstated



Running the courseware on Amazon Elastic Compute Cloud (EC2) 

This is recommended if running a virtual machine on your computer is too slow. This page has instructions for AWS setup tailored for the SaaS course.
Notes on VM networking using Amazon EC2

Once you have setup your instance (a one-time process), a typical work session would proceed as follows:
  1. Start or restart your instance and login.
  2. Port Tunnelling allows you to run a Web browser on your computer connecting to localhost:3000 (the default port for Rails apps) but have that connection automatically forwarded to port 3000 on the VM.  This lets you do development on the VM but use a Web browser on your local computer to interact with your app.  To setup tunnelling from port 3000 on your local computer, use the following command:
    • On your computer (Mac OS X or Linux) in a terminal window, type:
      ssh -L *:3000:localhost:3000 -i yourkey.pem ubuntu@yourinstance
      replacing yourkey with the filename containing the keypair you used to login to your instance, and yourinstance with the hostname or IP address of your running instance (usually something like ec2-54-198-222-64.compute-1.amazonaws.com).
    • Windows using PuTTY: follow these instructions, using 3000 as the Source Port and localhost:3000 as the destination (and ignore the part about running MySQL Administrator)
  3. When you finish a work session, you should use the Instance Actions menu on the AWS Management Console to stop it, so you don't continue to accumulate usage charges. 
    • If you STOP an instance, the virtual disk connected to it persists, so you usually want this option. Usage charges for persisting the disk will apply once you have exhausted the limits of the Free tier. 
    • If you TERMINATE an instance, the virtual disk connected to it may be destroyed, depending on the  settings of the AMI used to launch the instance.  (AWS will warn you if this is the case, because if the EBS volume is destroyed,  everything on it including your work is lost forever!)  Since the Free tier includes 750 compute-hours per month for a full year, you should not need to  terminate the instance while taking this course. (Even if you do, though, you should be using Git and GitHub to back up your important work to the cloud, as described in Appendix A of the book.)

Downloading and running the courseware on your own computer

  1. Download and install the free VirtualBox on your host computer, which can be any Intel-based Mac, Windows PC, or Linux box
  2. Download and unzip the VM image (~2GB zipped) from the links in the table at the top of this page. If you encounter problems unzipping the VM (default unzip software may not be sufficient on older operating systems), 7zip is a free unzip program.
  3. Run VirtualBox and click the New button to create a new VM.
  4. When the VM Wizard appears, select the following options:
    • operating system: Linux
    • version: Ubuntu
    • RAM base memory: at least 1024 MB
    • Select "Use existing hard disk" and choose the .vdi file you downloaded in step 2
  5. This screencast explains how to set up, boot and log in to the VM.
  6. Make sure you have network access by opening the Firefox browser (icon located along left screen edge when VM is running) and visiting a popular site such as Google.com. Here is troubleshooting information if you have networking issues.
  7. Highly recommended: enable Shared Folders and Copy/Paste, which allows you to view and edit files residing in the VM image using an editor on your host computer and to copy and paste text between the VM and your host computer:
    • In VirtualBox, choose Devices > Install Guest Additions 
    • Choose Enable Shared Folders and Copy & Paste
A typical work session using the VirtualBox VM proceeds as follows:
  1. Start VirtualBox, select the saasbook VM, and click the Start button.
  2. Do your work.
  3. When you're ready to quit, select Close from the VirtualBox Machine menu. You have three choices of what to do with your VM state.
    1. Save virtual machine state means the next time you resume, the VM will be exactly as you left it, like standby/resume on your host computer
    2. Send shutdown signal will shut down the VM's (guest) OS in an orderly way; your changes will be saved, but the next time you restart the VM, any programs that were running in the VM will have been shut down.  This is like using the shutdown command in the table of "useful VM commands" above.
    3. Power off  is like pulling the plug on the VM, and there is a risk that some data may be lost.  This option is not recommended except as a last resort if the other options don't work. This is like using the reboot -q command in the table below.

A note on VirtualBox VM networking

VirtualBox uses network address translation (NAT) by default, giving your VM a 10.0.0.* address that is routable from your host computer but not from the outside world. VirtualBox offers other networking options if this doesn't work in your setup. 

If your host computer is connected to the Internet, your VM will be too.  However, if you suspend (sleep) your host computer and then wake it up on a different physical network (for example, sleep your computer at work, then travel home and wake it up there), you will need to restart the VM's networking subsystem or networking will appear to be broken.  The table of useful VM commands below shows how to do this.  If the network restart doesn't work, reboot your VM.

Useful commands while working with the VM

The VM's root (administrator) password is saasbook - you will need to supply it when doing certain administration tasks, such as any command line that begins with sudo.

sudo /etc/init.d
  networking restart
 Restart VM networking when host computer is susepnded and then resumed on a different network.  (Not applicable if using EC2)
 sudo /sbin/reboot Reboot VM gracefully
 sudo /sbin/reboot -q Reboot VM forcibly (if gracefully doesn't work)
 sudo /sbin/shutdown   Shut down VM gracefully (add -q for forcefully, if gracefully doesn't work)

Installing the software yourself into a new VirtualBox VM 

  1. Download and install the free VirtualBox on your Intel-based Mac, Windows PC, or Linux box. 
  2. Download the 32-bit Ubuntu 11.10 installation image (iso) from http://www.ubuntu.com/download/ubuntu
  3. Open Virtualbox, click "new", choose "next"
  4. Enter the name you want for the VM (we suggest "saasbook"), and choose Linux and Ubuntu (32-bit) for the OS and Version
  5. Allocate at least 1024MB for memory
  6. Choose "Create new hard disk", choose "VDI" filetype, then "Dynamically allocated"
  7. Specify where to save the .vdi file, and allow 10GB for the virtual disk (you may allow more or less, depending on how much you will add to the image and how much free space you have on your hard drive)
  8. Choose "Create"
  9. Your VM should now show up in VirtualBox; select it, and start it.
  10. The First Run Wizard will appear; choose "Next"
  11. Navigate to the Ubuntu .iso file you downloaded in step 2, and boot from it
  12. Choose "Start", and click through any VirtualBox prompts (you may wish to read them and follow their advice)
  13. Ubuntu should now be running; select your language and choose "Install Ubuntu"  (You can select "Download updates while installing" if you wish, but it will make the VM larger and slow down the installation; we don't recommend it.)
  14. Select "Install this third-party software", and continue
  15. Select "Erase disk and install Ubuntu", and continue
  16. Select "Install Now"
  17. While Ubuntu is configuring, set your location and keyboard preferences
  18. In the "Who are you?" dialog, enter the following:
    •  Your name: saasbook
    •  computer's name: saasbook
    •  username: saasbook
    •  password: saasbook
    •  Log in automatically
  19. Choose "Continue", wait for Ubuntu to install
  20. Click "Restart Now", and when prompted to remove installation media, choose "Devices" > "CD/DVD Devices" in the VirtualBox menu and make sure that no media has a check mark next to it (if one does, just click it to unmount it); press <ENTER> to continue restarting
  21. When restart is complete, in Terminal window say sudo passwd root and set root password to saasbook
  22.  when prompted, choose to run the program with "Autorun Prompt"
  23.    when done, eject the media by right-clicking on it in the launcher and selecting "Eject"
  24.    if there is an icon that looks like a PCI card in the upper right, click it and install drivers
  25.  (Optional) Remove unnecessary shortcuts on launcher, add one for terminal
  26.  (Optional) Remove unnecessary folders in home folder
  27.  set gedit ("ed") as default text editor with "sudo update-alternatives --config editor"
  28. Give the following command to download our configuration script:
  29. wget -O configure_image.sh  
  30. https://raw.github.com/saasbook/courseware/master/vm-setup/configure-image-XXX.shreplacing XXX with the appropriate book version number (see table at top of this page).
  31. Run the script:   . configure_image.sh
  32. Highly recommended: enable Shared Folders and Copy & Paste as described in step 6 of "To download the prepopulated VM image" above. This screencast may help.
  33. Open Firefox, go to https://addons.mozilla.org/en-US/firefox/addon/web-developer/, click "Add to Firefox"

Installing the software yourself on an existing system (experienced users only)

Use git to clone the repo github.com:saasbook/courseware.  In the vm-setup directory you'll find shell scripts for configuring various versions of the VM.  These scripts assume starting from a clean Ubuntu image, so they may not work out-of-the-box on your equipment, but you should be able to figure out what is being installed.
Comments