Adding VirtualBox Guest Addition to Fedora 17

I decide to try one of the different Fedora 17 Spins today and I was again faced with getting the guest additions added. Getting the additions installed is not hard, but when I don't do someting with regularity, I don't always remember how to do it. So I decided to write a quick How To, because I'm sure I'll be doing this again.

The first step is to select Install Guest Additions from the Device menu. Once you've done that, start a terminal session. You will now need to become root. You can do this by either entering

su -
or
sudo su -

Make sure you have the last updates.

yum update

Once the updates have been installed, you will want to reboot the instance. Once the instance has restarted, you will need to install gcc, kernel-devel and kernel-headers, if they have not been installed.

yum install gcc kernel-devel kernel-headers

Now add the environment variable KERN_DIR

KERN_DIR=/usr/src/kernels/`uname -r`
export KERN_DIR

Now you are ready to install the Guest Additions.

cd /run/media/userdir/VirtualBoxGuestAdditions
./VBoxLinuxAdditions.run

Once the installation is complete, restart the instance.