Daily Archives: February 20, 2011

VirtualBox is very cool!

Don’t know if you all have a need for virtualized iron; but if you do, you should check out VirtualBox for your virtualization needs. I’ve been tracking it since the 1.x release days and after a few years of doing VMWare pretty much moved the criticial stuff I like to do to it. Here’s a pathway of sorts for how I do things for Linux stuff:

  1. Setup a new Ubuntu Virtualbox guest on a host. Get the latest updates in place, add in the software I need. As an example, I just built a custom guest for Atlassian Confluence and Jira. The guest needs to have about 1g of memory and does not need a GUI to make it work. I also need to publish NAT forwarding rules so I can reach the guest when I run it headless or with no window going. Used to be you had to create these on the command-line by doing so-called “manage” commands. Now there is slick UI for it which just works. I also have a need to set a few time markers for major decisions so I setup a few snapshots of different points in time that I can roll back to. When I get this done, I setup the webkits for the applications, copy over some known good configuration files for apache2 and the setup files for each of the major applications. I create the /etc/init/ rules to make the software come back after a reboot. Then I test the reboot rules. At some point, it all just works. I’m careful to not finalized the licensing details until I move the development efforts to the host I will be using things at. I don’t like violating license agreements.
  2. At this point, I’ve reached a decision point in rolling out the new guest image for use. I’ve demonstrated that it works and captured notes for my own use along with configuration files. This part is really important folks. The configuration files are re-usable containers which I have found I need more than once. Saving them to my Qnap NAS is critical. So now I snapshot things again. Second snapshot. On to the final stage.
  3. Now I’m ready to get some final steps done. I add in the guest additions by first installing the kernel headers and essentials packages into the server image. The image is just about done. I do one more systemic update/upgrade. The system is now gold to my standards. Its ready for exporting. I export on the command-line by doing “VBoxManage clonevdi” against the original vdi file to a new location. Then I copy it to a USB drive and then over to the final destination.
  4. When I move it over, things don’t work on Linux like the network card. Its using the ruleset in /etc/udev/70-persistent-net.rules. I empty that file on the new host and reboot. That makes the system rewrite the udev rules for the network card and it comes up as eth0. Now the new guest is ready and I ensure that all my services like jira and confluence come up right. I have the licenses ready to go so I apply them. Now its getting close to being done.

So, there are other baselines I have built on Ubuntu as well which speeds up this process as you can guess. What I’ve done is build a basic VirtualBox guest which does Apache2, php, and mysql since I find myself wanting these often. It also has ssh enabled and its updated for the most part. Very handy to have a core set of image files one can export and use as the need arises. I also have a core Ubuntu Desktop image which I can deploy as I need. This worked out actually quite well for a co-worker that was used to VirtualBox but had no time to build the guest. I gave the person the image file on a USB key. The person was up and running in hours and was able to securely cruise the web as she wanted with a decent graphical environment. 

I also use VirtualBox for Windows7. I don’t particularly like or want Windows systems. They are too prone to crash, get registry corruption, need antivirus and malware and just about everything else I’m too lazy to do these days. By using the snapshot utility vigorously, I have not had to re-install a windows guest even after making a mistake with some stuff once. I just roll things back and I’m back to a known good state. Well… This is Windows. So its not really good. More like okay. But the principle works on Windows too except for Windows activation key nonsense. I’m glad to have a technet pro account though. Saves some time with the usual BS around license keys.

So, that’s the basic way I use VirtualBox to satisfy my needs to test out new software, deploy it into new containers, backup those containers, and then get more use from them. Very easy way to screen off web and other applications into secure containers behind a NAT interface. Also very easy to provide an environment to someone else that needs to test out something. Its all good.

Now how about the ways you use Virtualized environments. Do you develop software in appliance sandboxes? Do security testing in virtual guests? Use them for banking or fun? There are thousands of ways to get use. How do you? You can’t complain about the price of VirtualBox either. Free. I like Free!

Comments Off

Filed under Ideas, Linux