Forward to page content

Jason P. Brown's Web Site

(Blog) »

Building an Ubuntu Dev Platform: Part 1 – VirtualBox

The goal of this article is to build, using Sun’s VirtualBox, a basic Ubuntu 9.10 virtual machine (VM) for the development of PHP and Ruby on Rails (RoR) applications.  We will be relying on the nginx web server, MySQL database engine, and Phusion Passenger (along with their Ruby Enterprise Edition) in order to keep the development platform consistent with my particular production environment.

While much of this is specific to my particular requirements, this would be a good starting point for anyone looking to get their feet wet with PHP and/or RoR application development.  It would also be a good starting point for people interested in familiarizing or re-acquainting themselves with Linux, as Ubuntu is about as newb-friendly as Linux distributions get.

I should also note that even though I’m installing this as a virtual machine, it would work equally well on a real machine without the use of VirtualBox.  If you are going that route, or you are familiar with creating new virtual machines, then skip the first step altogether and go on to part 2.

Create the Virtual Machine

Install the latest release of VirtualBox for your existing platform.  The latest version at time of writing was 3.1.2.

Once installed, launch VirtualBox. From the Machine menu, select New (or press CTRL+N) to start the  Create New Virtual Machine wizard.  Click Next to continue past the welcome screen to the Name and OS Type selection screen.

Create VM - Name and OS Type

Enter a descriptive name (like UbuntuDev) in the text box provided, and choose Linux from the Operating System drop-down.  After selecting Linux, the drop-down for Version automatically changed to Ubuntu on my version of VirtualBox.  If you are running a 64-bit host operating system with an architecture that supports VT-x or AMD-V virtualization technologies, then you can change the Version to Ubuntu (64 bit).  If what I just said made you dizzy, you aren’t sure how to check, or you might be exporting the VM for use on a computer you are unsure of, then leave the Version as Ubuntu.  There is no significant difference for our purposes, but make a note of which you selected so that you know whether to be downloading 32-bit or 64-bit binaries as we go on.   Click Next to continue to the Memory screen.

Create VM - Memory allocation

Select the amount of memory (RAM) you’d like to dedicate to the Ubuntu VM.  A good rule of thumb is to assign less than half of your computer’s physical RAM to your VM, but you should never need more than 2GB (2048MB) for this sort of appliance.  In fact, 1GB (1024mb) should be more than enough.  Also, keep in mind that this RAM is only used while the VM is running, so it’s not like you have to be overly stingy either.  Click Next to continue to the Virtual Hard Disk screen.

Create VM - Virtual Hard Disk

The Virtual Hard Disk screen is cake, assuming that Boot Hard Disk (Primary Master) is checked, and Create new hard disk is selected, you can click Next to spawn the New Virtual Disk wizard screen.  At the Welcome screen, click Next to continue to the Hard Disk Storage Type selection.

Create VM - Disk Storage Type

Another easy one, choose Dynamically expanding storage, and click Next to continue on to the Disk Location and Size screen.

Create VM - Virtual Disk Location and Size

The Location field should be auto-populated with a variation of the name you chose for this VM, but feel free to change it if you like.  The Size warrants some consideration.  First, an explanation; virtual disks are represented individually as single large files on your hard drive.  Had we chose Fixed-size storage on the previous screen, then whatever value we enter here would determine the size of the corresponding file.  However, since we chose Dynamically expanding storage, the size selected here only represents the largest possible size the virtual drive could consume, but in reality the file stored on our physical hard drive will be much smaller.  In this specific case, it will be less than 5GB after we’ve installed everything.  In addition, running out of space is kind of a pain to rectify, so we definitely don’t want to be stingy.  Mine defaulted to 8.00 GB, and even though I know that will be enough room for this VM’s intended purpose, I doubled it to be safe. Tripling it works too, or even quadrupling it since it is very unlikely that this VM will ever need that much space, and it will likely sit below 10gb for the duration of it’s lifespan.  Once you’ve selected a size, click Next to see the virtual disk summary screen.  If everything looks right, Finish to return to the virtual machine summary page.

Create VM - Summary

Review, and when ready, click Finish there too.

Need a break?  Take one, otherwise you can continue on to Part 2 – Installing Ubuntu.

Blogroll

Internet Explorer version 6.0 is not supported on this site, and soon enough, the entire internet. For the sake of all that is good in this world, upgrade to a modern browser, please.

I suggest one of the following:

  1. Firefox 3.6+ (from Mozilla)
  2. Chrome 4.0+ (from Google)
  3. Opera 10.5+ (from, well, Opera)
  4. Safari 4.0+ (from Apple)
  5. Internet Explorer 8.0+ (from Microsoft)