Installing VirtualBox on Centos 5.2

Tags:

Full instructions, particularly for "headless" installation, are here.

First we download the RPM for RedHat Enterprise Linux 5 (RHEL 5) which is the equivalent to Centos from the virtualbox.org site

After downloading (and renaming the file to eliminate everything after the .rpm) we install as follows but get an error:

# rpm -ivh VirtualBox-2.1.0_(version).rpm
...
No precompiled module for this kernel found! ...
Compilation of kernel module FAILED! ...
Please consult
   /var/log/vbox-install.log
to find out why the kernel module does not compile.
Most probably the kernel sources are not found.
Install them and execute
   <strong>/etc/init.d/vboxdrv setup</strong>
as root.

To rectify this:

# yum install SDL kernel-devel kernel-headers
# KERN_DIR=/usr/src/kernels/2.6.18-whatever-your-current-kernel
# export KERN_DIR
# /etc/init.d/vboxdrv setup

Then add users to the vboxusers group:

# /usr/sbin/usermod -a -G vboxusers yourusername

and you should be able to launch VirtualBox from the Applications / System Tools menu.

Have fun!