Friday, June 26, 2009

Installing VirtualBox machine Additions on CentOS 5.1 - 5.3

For a few weeks now I have been creating a VirtualBox VM for a demo server. The purpose is to give our sales staff a way to bring our technology to the client and show them, in a live environment how our systems works, even if they don't have an Internet connection available.

I have been working on this system in a ridicously small screen for a little while now and finally got sick of it. I had tried installing the Virtual Machine additions before, but it failed for one reason or another. This time around I was determined to get everything up and running properly, so A) I wouldn't have to work on such a small screen and B) I could just move my mouse between the VM and my Desktop with out hitting a button.

Anyways, on to the meat of this, how to install the pre-requsite libraries and the Virtual Machine additons on CentOS. Now I just did this on a CentOS 5.3 install, but it has reportidly worked as far back as 5.1.

First you need to install the kernel sources and gcc, if you don't already have them.

yum isntall -y gcc
yum install -y kernel sources kernel-devel

Then you need to create a symbolic link to the kernel source:
ln -s /usr/src/kernels/2.6.18-92.1.18.el5-i686 /usr/src/linux

After this it is best to reboot the machine:
shutdown -r now

Once the machine has come back online you can mount the Guest additions ISO and install them via one of two commands depending on your architecture:

sh VBoxLinuxAdditions-x86.run

or
sh VBoxLinuxAddtions-amd64.run


After either of these commands are run you will have to once again reboot the Virtual Machine:
shutdown -r now

After the reboot you should be able to move the mouse between the VM and you Host OS without unlocking it and any of the other nifty features the Guest additions add.