Options for getting and using the bookware
You have a number of different options for setting up the software for use with the textbook or in a SaaS course:
- Run the VM image within VirtualBox on your own computer:
Use Amazon Elastic Compute Cloud to deploy the VM image in the cloud:
- This is the recommended approach and the most straightforward. It involves installing the free VirtualBox software (for Intel-based Macs, Windows PCs, or Linux computers) and downloading the SaaS course Virtual Machine image to use within it.
- 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!)
Install the SaaS course software on an existing Ubuntu system:
- Use this option if, for example, you don’t have a computer with enough spare capacity to run the VirtualBox option.
- 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.) Note that the Kindle edition of the textbook now comes with a free $10 of AWS credit.
Use a cloud hosted editor system such as Cloud9 or Nitrous (not 100% tested)
- 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.
- One interesting possibility is to use vagrant to create a blank ubuntu instance on which to install the courseware.
- In the past some students have managed to complete the homeworks using cloud hosted editors such as Cloud9 or Nitrous. We have yet to thoroughly test these alternatives.
Which version of the VM should I use?
||VM image to download and deploy on VirtualBox hypervisor)
||Amazon AMI ID (see instructions below)
|< 0.10.0 (Beta Edition)
||Downloadable VM no longer available
||ami-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)
|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
|| 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
Option 1: Run the VM image within VirtualBox on your own computer
- Download and install the free VirtualBox on your host computer, which can be any Intel-based Mac, Windows PC, or Linux box
- 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.
- Run VirtualBox and click the New button to create a new VM.
- When the VM Wizard appears, select the following options:
This screencast explains how to set up, boot and log in to the VM.
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.
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:
- 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
A typical work session using the VirtualBox VM proceeds as follows:
- In VirtualBox, choose Devices > Install Guest Additions
- Choose Enable Shared Folders and Copy & Paste
- Start VirtualBox, select the
saasbook VM, and click the Start button.
- Do your work.
- 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.
- 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.
- 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.
- 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
| Restart VM networking when host computer is susepnded and then resumed on a different network. (Not applicable if using EC2)
| Reboot VM gracefully
sudo /sbin/reboot -q
| Reboot VM forcibly (if gracefully doesn't work)
| Shut down VM gracefully (add
-q for forcefully, if gracefully doesn't work)
Installing the software yourself into a new VirtualBox VM
- Download and install the free VirtualBox on your Intel-based Mac, Windows PC, or Linux box.
- Download the 32-bit Ubuntu 11.10 installation image (iso) from http://www.ubuntu.com/download/ubuntu
Open Virtualbox, click "new", choose "next"
Enter the name you want for the VM (we suggest "saasbook"), and choose Linux and Ubuntu (32-bit) for the OS and Version
Allocate at least 1024MB for memory
Choose "Create new hard disk", choose "VDI" filetype, then "Dynamically allocated"
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)
Your VM should now show up in VirtualBox; select it, and start it.
The First Run Wizard will appear; choose "Next"
Navigate to the Ubuntu .iso file you downloaded in step 2, and boot from it
Choose "Start", and click through any VirtualBox prompts (you may wish to read them and follow their advice)
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.)
Select "Install this third-party software", and continue
Select "Erase disk and install Ubuntu", and continue
Select "Install Now"
While Ubuntu is configuring, set your location and keyboard preferences
In the "Who are you?" dialog, enter the following:
Your name: saasbook
computer's name: saasbook
Log in automatically
Choose "Continue", wait for Ubuntu to install
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
When restart is complete, in Terminal window say sudo passwd root and set root password to saasbook
when prompted, choose to run the program with "Autorun Prompt"
when done, eject the media by right-clicking on it in the launcher and selecting "Eject"
if there is an icon that looks like a PCI card in the upper right, click it and install drivers
(Optional) Remove unnecessary shortcuts on launcher, add one for terminal
(Optional) Remove unnecessary folders in home folder
set gedit ("ed") as default text editor with "sudo update-alternatives --config editor"
Give the following command to download our configuration script:
wget -O configure_image.sh
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).
Run the script: . configure_image.sh
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.
Open Firefox, go to https://addons.mozilla.org/en-US/firefox/addon/web-developer/, click "Add to Firefox"
Option 2: Use Amazon Elastic Compute Cloud (EC2) to deploy the VM image in the cloud
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:
- Start or restart your instance and login.
- 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:
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.
- 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)
- 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.)
Option 3: 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. One way to get a clean Ubuntu image is to use vagrant to create a blank ubuntu instance on which to install the courseware.
Option 4: Using a Cloud hosted editor (not 100% tested)
In the past some students have managed to complete the homeworks using cloud hosted editors such as Cloud9 or Nitrous. We have yet to thoroughly test these alternatives. There are some notes on getting set up with c9: