Welcome to part 2 in a series of articles on building, using Sun’s VirtualBox, a basic Ubuntu 9.10 virtual machine (VM) for the development of PHP and Ruby on Rails (RoR) applications. However, we aren’t quite there yet. In this step, we are installing Ubuntu Linux (9.10) on the blank Virtual Machine we created in part 1.
Install Ubuntu
Download Ubuntu. By default, the button downloads the 32-bit version. If you need 64-bit, or a version other than the one listed, click on the Alternative download options link to expose more options. When it’s done, you should have an disc image (.ISO) of the installation media on your hard drive. If you are installing on a blank computer rather than a virtual machine (VM), you will want to burn that .ISO to a CD. In Windows 7 it’s part of the native functionality, but explaining how to do that is outside the scope of this article.
Next we need to insert the media into our VM so it is available for installation. The easiest way to accomplish that on a brand new VM is just to go ahead and start it. You can do this by double-clicking the name of the VM in the main VirtualBox window. This will prompt you with the First Run wizard. Click next to pass the welcome screen and you will arrive at the Select Installation Media screen.
CD/DVD-ROM Device should be selected by default. If not, make it so. Under Media Source, click on the folder icon to the right of the drop-down. This will launch the Virtual Media Manager with the CD/DVD Images tab selected.
Click on the Add icon and browse to, then select, the Ubuntu .ISO you previously downloaded. This will close the Virtual Media Manager and return you to the First Run wizards Select Installation Media screen. Note the Media Source.
Clicking Next will take you to a summary page. Click Finish to begin booting the VM with the selected installation media. The Ubuntu install should begin almost immediately.
Use your arrow keys to select your language, then hit enter. At the resulting menu, select Install Ubuntu. This will load a GUI installer for Ubuntu.
I have to tell you, the Ubuntu installation is about as easy as OS installations can get. Select your Language, timezone, keyboard preferences, partitioning scheme, enter your user information, and let ‘er rip. For me, the timezone and user information screen were the only two I needed to provide meaningful input for, the rest were good by default.
When it’s time to restart the machine you will prompted to remove the installation media. You can do this easily enough from the VirtualBox menu at the top of the VM window; Devices => CD/DVD Devices => Unmount CD/DVD Device. At the point, you can safely reboot by pressing the Enter key.
Once the VM comes back up, and you’ve logged in to your new Ubuntu installation for the very first time, the first thing you will want to do is install any update that has been published for your version. Do this through the GUI by navigating the System menu at the top left of your Ubuntu interface (System => Administration => Update Manager), or through the command line by bringing up a terminal window (Applications => Accessories => Terminal) and entering the following commands:
The dollar sign is not part of the command but is displayed to indicate the start of a new line which will be helpful when my examples start wrapping.
$ sudo aptitude update
$ sudo aptitude upgrade
As soon as that is finished, you might have/want to reboot the virtual machine.
$ sudo shutdown now -r
Our next step is installing the VirtualBox Guest Additions which are a set of tools designed to make interacting with your new VM a whole lot easier. Using the VirtualBox menu, select Devices => Install Guest Additions… or simple press your Host key and the D key together (Right CTRL + D by default). This will mount the Guest Additions CD and probably prompt you with a worthless auto-play window. Go ahead and cancel out of that, and return to your terminal window.
For 32-bit systems:
$ sudo /media/cdrom/VBoxLinuxAdditions-x86.run
For 64-bit systems:
$ sudo /media/cdrom/VBoxLinuxAdditions-amd64.run
Time for another reboot.
$ sudo shutdown now -r
Once it is back up, your are ready to continue on to the next step. However, if you are thinking you might want to share folder between your Host machine and your VM, it might behoove you to take a peek at this article I wrote on folder sharing. Otherwise, continue on to Step 3: MySQL, PHP, REE, and nginx via source through Passenger!



Pingback: Jason P. Brown » Building an Ubuntu Dev Platform: Part 1 – VirtualBox