This post explains the process of installing the VirtuaBox Guest Additions, in a CentOS 6 Guest (CLI).
The host is CentOS 6 server (CLI) running Headless VirtualBox 4.1 (not OSE version).
This post actually follows the previous post : VirtualBox Headless on CentOS 6 Server
Host Config
Guest Additions iso is in a folder witch your vbox user has no privileges (unless you run with root), so we need to copy it to another location, the vms folder works just fine.
cp /usr/share/virtualbox/VBoxGuestAdditions.iso //
Now let´s mount the iso.
Note:I\’ll assume yout storage controller is named “storage-ctrl”.
VBoxManage storageattach myvmname --storagectl "storage-ctrl" --port 1 --device 0 --type dvddrive --medium / /VBoxGuestAdditions.iso
Guest Config
Let\’s mount the iso image inside the guest.
mkdir /media/VBoxGuestAdditions mount -r /dev/cdrom /media/VBoxGuestAdditions
And install DKMS (Dynamic Kernel Module Support)
cd ~ yum -y install wget rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm rpm -i rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm rm -f rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm yum update yum -y install dkms
Install kernel headers, and some build stuff, gcc and make
yum install make gcc kernel-devel kernel-headers
Let\’s reboot
shutdown -r now
Let\’s fix kernel dir. Probably not needed since we rebooted, but I guess it doesn\’t hurt, run:
KERN_DIR=/usr/src/kernels/`uname -r`-`uname -m` export KERN_DIR
Then run guest additions:
cd /media/VBoxGuestAdditions sh ./VBoxLinuxAdditions.run
In some case (like mine), you may get this error message, just break (ctrl+c):
The headers for the current running kernel were not found. If the following module compilation fails then this could be the reason.
Then install the devel kernel for the version you\’re running with:
yum install kernel-devel-`uname -r`
And run guest additions install again
sh ./VBoxLinuxAdditions.run
After install unmount the cd drive in the guest:
umount /media/VBoxGuestAdditions rmdir /media/VBoxGuestAdditions
If you get the message the device is busy, just go berserk and do:
fuser -k /media/VBoxGuestAdditions/
Then unmount
umount /media/VBoxGuestAdditions rmdir /media/VBoxGuestAdditions
And afterward (at the host) unmount the iso:
VBoxManage storageattach myvmname --storagectl "storage-ctrl" --port 1 --device 0 --type dvddrive --medium none
Pingback: VirtualBox Headless on CentOS 6 Server | iTespresso
Or you could just install php virtualbox and save yourself a load of ball ache :) code.google.com/p/phpvirtualbox/