One of the easiest ways to protect oneself whilst online is to function within a virtual machine environment. In such a scenario, even if you do catch a nasty bug doing something that you probably shouldn’t, the infection is confined to that virtual machine and does not spread to the rest of your computing environment.

To that end, I’ve been playing with Sun’s VirtualBox and the free distribution of Ubuntu Lucid Lynx (10.04). Together these make an unbeatable combination.

I got VirtualBox from here:

http://download.virtualbox.org/virtualbox/3.2.8/VirtualBox-3.2.8-64453-Win.exe

And, though I’m running Windows 7 64-bit, I downloaded the 32-bit version of Ubuntu from here:

http://www.ubuntu.com/desktop/get-ubuntu/download

Once VirtualBox is installed, you can directly install Ubuntu by mounting its ISO image into VirtualBox.

The only thing you should remember is to install the Guest Additions for Linux. Without doing so, maximizing the VirtualBox window does not maximize the Guest OS’s window. To do so, you need to choose Devices > Install Guest Additions to mount the guest additions disk image. Once this shows up on your desktop, browse into it, and execute the autorun.sh file from a Terminal window. If you don’t see it take effect right away, you might want to restart your virtual machine.

You can also share a folder between the host and guest operating systems, using the following commands:

1. Create the folder on the host OS. (C:\ubuntu-vbox)

2. Register it with Virtual Box using Devices > Shared Folders, and give it a logical name to be used later (ubuntu-vbox).

3. Create the mount point
$ sudo mkdir /mnt/shared

4. Next, mount the shared folder.
$ sudo mount.vboxsf ubuntu-vbox /mnt/shared

5. That’s it – now you can access files on /mnt/shared from Ubuntu, and on c:\ubuntu-vbox from Windows!

It is also very simple to install a complete LAMP stack – Apache 2, PHP 5, MySQL, and phpmyadmin on our fresh install of Ubuntu 10.04. Check out these links for tips:

http://blogote.com/2010/ubuntu/how-to-install-apache-2-on-ubuntu-10-04-with-php5-and-mysql-support-guide.html

http://www.shicho.net/lamp/?p=138

A key aspect of using Ubuntu in VirtualBox is to ensure that you have installed any guest additions. This enables sharing of folders as well as full screen displays. To install guest additions, first start up your Ubuntu instance. Then, select Devices > Install Guest Additions in the VirtualBox menu of your running Ubuntu instance. This adds a CD image to your Ubuntu  desktop named VBOXADDITIONS_<version>. Browse to this  image using the Places menu, and execute autorun.sh.

That’s the sprinkling of pixie dust necessary to get a fully functional Ubuntu install!