Blog

VirtualBox

User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active
 


VirtualBox is a rather nice open source virtual machine platform. I use it to run test boxes on my Toshiba A300D. This guide (correct at the time of writing) is posted here so that next time I rebuild the trusty Tosh I have a set of instructions on getting my virtual environment back up and running.

 

VirtualBox
Virtualbox on my Tosh A300D running virgin installations of Windows 7 Beta and Windows 2003 Server on an Ubuntu host.


For starters, here's a word to the wise. VirtualBox is available in the Ubuntu repositories and can be installed via Synaptic however the repos hold the Open Source Edition (virtualbox-ose) which has reduced functionality such as lack of USB support.

For full functionality you can still download and install VirtualBox free for personal use by visiting http://www.virtualbox.org and selecting the package that matches your OS and CPU platform. The good folk at Sun simply ask that if you want Enterprise licensing and support then you contact a Sun representative to discuss purchasing (which is fair enough).

I am not using it for any business related tasks however, just to build and break boxes as I attempt to further my own understanding by playing with the features and functions of various operating systems. Operating virtually sure has some advantages such as:

Robustness - doesn't matter if you break something, just roll back to the last snapshot;
Simplicity - One physical machine holding multiple virtual machines saves on power, space and interconnectivity;
Convenience
- Because I'm experimenting inside virtual machines I'm not making changes to my host operating system. If I really bugger up a virtual machine I can rebuild it without having to worry about my host OS and all my data/applications.

The disadvantage is with speed. A virtual machine will not run with the same performance as a dedicated operating system. You're also going to need a pretty high end computer if it's going to host multiple VM's.

Installation of VirtualBox is a breeze in Ubuntu and can either be done using Synaptic (for the OSE version) or by downloading and double-clicking the .deb file. After installation, VirtualBox will be listed in the menu under System Tools (if not, log out and back in to see it).

After starting the application you just need to click New to start defining the parameters of your first virtual machine. Give it a name, tell VB what OS you will be installing, the amount of physical memory you want to allocate to it, the amount of hard drive space to start with (you can use fixed size or dynamically expanding hard drives), and finally where the installation media is located (optical drive, ISO file, etc.)

With all the parameters set and installation media available, VirtualBox will allow you to start installing your OS of choice. In my case I have a 180 day evaluation of Windows Server 2003, an XP Client, a Windows 7 Beta machine and a mirror of this website running under Linux which was handy when testing and configuring the Joomla mods for this blog as I didn't want to work on the live system.

Once your virtual machine is installed it can be started from the console. The right-CTRL key is the default toggle and switches mouse control into or out of the VM's window.

We're not quite there though and some hoop jumping is required for USB to work.

You need to add your account to the vboxusers group created by the VirtualBox installation. You can do this in Gnome under System/Administration/Users and Groups or on the command line by entering:

sudo usermod -G vboxusers -a [your username]


You also need to change permissions for /dev/vboxdrv:

sudo chmod 660 /dev/vboxdrv
sudo chgrp vboxusers /dev/vboxdrv


Now enter:
grep vbox /etc/group


... and note the group number. This will be used in an entry in fstab:

sudo nano /etc/fstab


and add the following tab delimited line:

none    /proc/bus/usb   usbfs   devgid=groupnumber,devmode=664  0  0


Now restart the computer and insert your USB device (such as a flash drive) into the host computer, then fire up VirtualBox and click on one of the virtual machines. Click the Settings button and the USB option. You should now be able to enable the USB controller and add your flash drive or other detected USB device to the device filters list. Oh, and a word of caution, if your VM is running Windows XP without the service packs, don't tick the USB2 option or XP will go through its Found New Hardware wizard and fail to locate the drivers.

Now start your virtual machine and it should pick up your connected USB device (or you should be able to select it from the Devices list at the top of the VM window).


When it comes to networking, by default VB allocates a DHCP address to the virtual network adaptor in each machine and uses NAT to allow those machines to communicate with the outside world through the host computers physical network interface. You can override this and allow your VM to connect directly through the physical host interface providing direct connectivity to the host network should you so wish.

This can be done in the Settings options of each virtual machine by selecting Host Interface as the network adaptor and choosing which physical host interface VB should use (e.g. eth0, wlan0, etc.)

You can also change the type of adaptor VirtualBox presents to the virtual machine so if you have something like Windows 7 Beta which doesn't like the PCNet Fast III adaptor, you can switch it to the Intel Pro 1000 which it does like.

For those wishing to play with VirtualBox, the links below may prove useful.
http://www.virtualbox.org
https://help.ubuntu.com/community/VirtualBox