CentOS (1)
VirtualBox (1)

How do I install Virtual Box Guest Additions 3.x on CentOS 5.5?

Can't get the kernel sources sources via a yum package neatly.  following obtained mostly from: 
http://wiki.centos.org/HowTos/I_need_the_Kernel_Source

As root:

yum groupinstall "Development Tools"
yum groupinstall "Development Libraries"
yum install unifdef rpm-build


As a non-root user (people don't advise building kernels as root):
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros


Find the URL for the source rpm that matches the kernel version you have at:
http://mirror.centos.org/centos/5/updates/SRPMS/
or
http://mirror.centos.org/centos/5/os/SRPMS/

Now fetch it:
rpm -i http://mirror.centos.org/centos/5/updates/SRPMS/kernel-2.6.18-194.32.1.el5.src.rpm 

Unpack and prepare:
cd ~/rpmbuild/SPECS
rpmbuild -bp --target=`uname -m` kernel-2.6.spec


Now run the necessary make stuff so vboxadd won't complain. Note there is no make install at the end. You probably don't want that. Change linux-2.6.18.i686 to the appropriate subdirectory name:

cd ~/rpmbuild/BUILD/kernel-2.6.18/linux-2.6.18.i686
make oldconfig
make prepare
make


Become root again.
Now set the envrionment (replace "local" with the username of the user you used to build the kernel):

export KERN_DIR=/home/local/rpmbuild/BUILD/kernel-2.6.18/linux-2.6.18.i686/

Now tell vboxadd to build and such:

/etc/init.d/vboxadd setup

Now if you get an error and in the install log it shows that there was a problem with struct inode missing member u, then edit the Makefile for the module you are building. I found the module code in /opt/VBoxGuestAdditions-3.2.12/src/vboxguest-3.2.12.

Find the line that adds -DKERNEL_FC6 to KFLAGS

Just after that you will see a couple lines like:
# build defs
EXTRA_CFLAGS+=$(INCL) $(KFLAGS) $(KDEBUG)

add the -DKERNEL_FC6 to the end, like this:
EXTRA_CFLAGS += $(INCL) $(KFLAGS) $(KDEBUG) -DKERNEL_FC6

At the command prompt in the same directory,
make
make install

Reboot.

Comments

Add a Comment



NOTE: Comments are moderated and will not show until approved.