This is a short technical review of the Innotek VirtualBox software showing the pros and cons of server virtualization and consolidation as a whole. In this article I will show you how to install the VirtualBox application and get running, as a proof of concept, an Ubuntu Linux on top of Microsoft Vista OS as a host.
Why would you need server virtualization and consolidation
There are a lot of articles explaining what is, what is not and providing many reasons why you might need to virtualize your servers. I will approach the topic in a different way by just listing the pluses and minuses of the technology and will let you decide whether you need or want to use it.
I will start with the pluses:
Now the minuses of using virtualization:
Why Innotek VirtualBox
As some of you might be aware, there are a couple of other, more popular options such as VMWare server and Microsoft Virtual Server 2005 which however due to some software limitations are either not supporting Microsoft Windows Vista (VMWare support it with their latest beta, but I don’t like using beta’s) or Vista is not fully supported (MS Virtual Server supports Vista but only the Ultimate edition and it is also considered as beta).
This leaves me with no other option than VirtalBox. On the other hand, there are a couple of pluses which makes VirtualBox my favourite one:
Enough said, lets get to the action.
Installing VirtualBox
The installation itself is quite easy, if you haven’t decided to compile the binaries from the source. To keep it as simple as possible, I will just use the already compiled binaries which are available through the official website here, free of charge:
http://www.virtualbox.org/wiki/Downloads
Download the binary files for your architecture (note that x86 and 64bits have different distributions), extract the setup file and run it. What you would need to do is to click a couple of times on the next button and eventually you will have a fully working VirtualBox virtualizer – as I said quite simple task, which doesn’t require a PhD in Computer Science to complete.
Now the interesting part – adding and configuring the Virtual Machine and installing a completely different OS on it.
Creating a new Virtual Machine
This step is also extremely easy. I assume you have already started the VirtualBox application and that the welcome screen is in front of you. To add a new virtual machine, click on the ‘New’ tab at the top-left corner, or alternatively use the shortcut by pressing ‘Ctrl + N’. This will launch the ‘Virtual Machine Wizard’ which will guide you through the rest of the VM setup.
The first thing it will ask you is the machine name. Give it a descriptive name so you can easily distinguish it later. For example, if you are going to install Ubuntu (as we are) and you would be using the server edition instead of the desktop one, a good name would be ‘Ubuntu <version here> Server’. Of course you can use your own name there as well — it all depends on you.
The second ‘question’ on the same screen is the OS type. This isn’t really an important information, however it is good to fill in the exact OS type here as there are certain features and tweaks that might be available for you to use later on. If you are going to install Linux as guest OS, you will most probably want to select the 2.6 Kernel version, as most modern linux distros are running 2.6.
The third page within the setup wizard will ask you to allocate the base memory for the new system. Depending on your choice of OS the default recommended memory would be different. It is important to know that it is not recommended to have your HOST OS configured to use less memory than your virtual machine. This especially if you are going to use both simultaneously. Since I have 2Gigs available on my host system, I allocated 512MB to the guest os, which in percentages would be 25% of the total available RAM.
Next page asks you to either create or select the boot (or in other words, the primary) HDD for the machine. Now, here is the real beauty of virtualization. If you had previously configured a hard drive, you could directly connect it to your new machine. As the HDD itself is actually a simple file, there is no need of attaching, detaching, moving hardware pieces whatsoever. Since however, this is our first machine using the software, there are no HDDs available and we are going to create one. Click on the ‘New’ button to create it now.
While creating the new HDD you will be asked whether you would like the disk to be ‘Dynamically expanding image’ or a ‘Fixed-size image’. Now, reading through the documentation and specifications of the software, I couldn’t find any recommendations which one is better, but from my own experience with other virtual softwares, I came to the conclusion that:
‘Dynamically expanding image‘ is good in case you need to keep the space as minimal as possible. Using that option however there is a slight speed reduction due to the fact that the file is ever expanding and of course this leads to more real HDD cycles.
‘Fixed-size image‘ on the other hand, has a predefined size and it will not grow automagically. If you do not need those couple of gigs the fixed image will take but won’t use initially, go with that option since it doesn’t suffer the speed handicap of the expanding image.
Yet, once again, those recommendations are based on my own experience and are not backed up by any documentation/specification/benchmarks by Innotek.
Finally, select the space you would need to have the OS running. Please make sure that you have allocated enough space. You should always check with the OS you are going to install and see how much space a usual installation would take, then calculate the size of the software you want installed and add a bit of spare space just in case you need it later. Please note, that since this is a virtual system, you can always expand the drives by adding an additional HDD to the system, however you should also bear in mind that if you are going to use Unix/Linux systems it is a bit of pain to ‘resize’ the partitions once created.
In our case, since we are installing Ubuntu (and we will have KDE setup as well) the base would fit in about 5GB. Having in mind I would need a lot of software installed for the next couple of tutorials here on futurepages, I opted to go for 10GB HDD initially.
Now that you have the disc created, select it and use it as the primary/boot HDD. Click on the ‘Next’ and then on the ‘Finish’ button and you will have the virtual machine created. The screen should look like this:
On the left side of the main screen you see a list of all the virtual machines configured and their current state. Selecting a virtual machine will provide you with additional information displayed on the right side of the screen. There are also a couple of more options here — ‘Snapshots’ and ‘Description’.
The snapshots will create a backup of the virtual machine and will copy it exactly as it is at the time you have decided to take the snapshot. Please note — it will NOT create a screenshot but rather a snapshot of the virtual machine :)
Description is pretty much clear — you can add notes/descriptions to the virtual machine, which in my experience can proof to be simple but quite valuable feature.
Installing the guest OS
Now that we have the virtual machine ready, we will proceed with the OS installation. If you have ever installed any OS using CD/DVD then you will be familiar with the next steps — it’s just a bit better because you do not actually need to burn the image on a disc, but instead mount it directly into the virtual machine.
First thing of course is to obtain an installation image of the OS. I have already mentioned that the target OS for this small tutorial is Ubuntu. Since I hate long downloads, I have selected the minimal Ubuntu image available at:
http://www.ubuntu.com/getubuntu/
Select a download location on your computer (it is a good practice to create a separate folder where you will keep the images so you can mount them easily, though if you are going to use just a single virtual machine you can save it wherever you like) and start download it.
While the archive is being downloaded, we are going to finish the initial configuration of the virtual machine so it will be ready to face the Ubuntu OS.
The first thing that would happen after starting the machine will be to make the system boot from the CD image inside the CDROM. To arrange and configure the booting sequence, select the Virtual Machine from the list, then select Machine -> Settings from the menu (shortcut is Ctrl+s), select ‘General‘ from the list of options and then ‘Advanced‘ from the tab panel. You can see my setup here:
While we are there, now is the time to configure the initial networking of the system. On the same window, just a bit further down in the list, you will notice the ‘Network’ configuration menu option. Click on it to bring up the Network Configuration panel. As you can see, you can have up to 4 network adapters connected to the virtual machine, though in most cases you will probably need just one. Make sure that ‘Enable Network Adapter‘ and ‘Cable Connected‘ to ensure that the adapter is configured properly and will be reported to the OS once it requests network access.
Before proceeding further however, it is important to understand what the various options under the ‘Attached To‘ select box means. Currently, in the version I’m using, the options are as follows:
The NAT, which is short of Network Address Translation (and also known as IP Masquerading), is the easiest way to have a working network connection available for your virtual machine. What it does is to create an internal network inside VirtualBox and assign the virtual machine a unique (yet internal and private) IP address. When the machine sends a network request, this request is being handled by VirtualBox acting like a router. The request is being then sent to your host machine real network interface and processed by your ISP just like a normal request from your real OS. Important here is to note that, unless you setup some special forwarding rules on your host machine, you won’t be able to directly query the machine through a public IP address. For example, if you install Apache web server on the virtual machine, you won’t be able to access it outside your public IP. This is due to the fact that the machine is using a private (internal) IP address to operate and have no public IP assigned.
Unlike NAT, the Host Interface, provides you with a way to have a public IP address assigned to your Virtual Machine. Before setting up a host interface connection however, you need to actually create the host interface itself. This is done using the controls provided for you on the same screen. Adding the host interface is easy — just click on the ‘Add New Interface’ button and the software will add it for you. This interface is created on your host OS (the real one). You can manipulate it, bridge it, whatever you would like, just like a normal interface. The important thing to note here is that in order to use this option you need to have wired connection. At least I wasn’t able to make my wireless one to work and to bridge the real adapter and assign an IP address.
The Internal network is just like NAT, except that the virtual machine will not have Internet access. In other words, all you will be able to access through the virtual machine are other virtual machines you have setup and the shared folder.
Having that said, I recommend using NAT at this time, at least during the installation as it doesn’t require any specific configurations and works out of the box without any problems. This will allow us to have the Ubuntu installer connect to our virtual DHCP server (which is setup for you when you choose the NAT option), obtain a private IP address and use it to fetch some installation files.
If you have selected the Ubuntu minimal installation disk, it should have been downloaded by now. Lets go and instruct the VM what it should boot when started. Since we have configured it to boot from CD-ROM first, we will need to add the downloaded installation image as a CD. As I have previous explained, we don’t need to burn any CDs, because VirtualBox software can mount the image directly from your hard drive. To do so, click on the CD/DVD ROM menu option on the same screen where we have configured the boot order and the network. Make sure that ‘Mount CD/DVD Drive‘ is checked, select ‘ISO Image File‘ and browse until you find the installation file you have just downloaded.
Now, click on ‘OK’ to save the changes and power on the machine. VirtualBox should now open a new window for your new virtual machine and will boot through the CD. I will not cover the actual Ubuntu OS installation here, as it is quite trivial, yet if you need help or detailed tutorial on how to proceed with the OS install, please see Grant’s article about installing an Ubuntu server — it should be under the ‘Ubuntu’ category on this site.
Eventually, if you have installed the KDE, you should end up with a screen like this:
Beautiful, isn’t it? :)
Post-installation tasks and additional features
By now, you should have a fully working Ubuntu Linux installed on the virtual machine, which is ready to have some software installed, but before doing so I can recommend you to first take a backup of the current state, so that you won’t need to re-install the whole system should something goes wrong.
Taking a backup of your virtual machine is extremely easy. To do so, you would just need to open the virtual machine manager window, while your VS is working and select ‘Machine’ -> ‘Take a SnapShot’ from the menu. Below is a screen showing you the exact location of this option:
Taking the snapshot will take some time, depending on the size and the type of the disc(s) you have created. Once created, you will have a full independent copy of the virtual machine with a save state exactly as it has been at the time of the snapshot creation. Should you need to restore it in the future, you will need to open the main VirtualBox window, select the virtual machine from the list of machines, click on the snapshots tab, select the snapshot you would like to restore and click on the revert to snapshot button. It is important to note though that in order to restore it, you should first stop the virtual machine as the button will be grayed if the system is already running. Below is a screen showing you the exact location:
That’s it! :) We have now a fully operational (and backed up!) Linux running on top of MS Windows Vista. There are more ‘tricks’ and features you can use with VirtualBox (i.e adding a RDP support connection and multiple machines running on a host system without a new window having popped up for them) but I won’t cover them here as it is out of the point of this article.