Installing VirtualBox Guest Additions on Oracle Enterprise Linux 6 Guest

Are you having trouble getting Guest Additions installed on your OEL 6 guest machine in VirtualBox? I had quite a time with it myself, and while I am not the first person to encounter the issue, I had to combine tips from a few places and gain some additional understanding about Oracle Enterprise Linux to get it to work.

Assuming you’ve already installed Linux, you can start installation of Guest Additions from the VirtualBox Devices menu:

On the desktop, you will now find a shortcut to the Guest Additions. You might be prompted to open the Autorun Prompt, do this andyou should see the Guest Additions Installation start… and fail:

You are advised to examine the log at /var/log/vboxadd-install.log to figure out the cause, which in my case the log included:

/tmp/vbox.0/Makefile.include.header:97: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again. Stop.

To resolve this you must install the kernel source which is not there by default. The Guest Additions Installation output suggests you install it via yum and even provides you the command to do so, but not so fast… if you don’t have yum configured yet  that will fail too. And you will also need the gcc package for the installer to update the kernel, but don’t worry, it’s all covered below. If you are running a version of Oracle Linux other than 6, you might visit first to get the correct URL for the below setup, otherwise:
# cd /etc/yum.repos.d
Next, use yum to install everything you need to get that Guest Additions Installer to work!
# yum update

# yum install gcc
# yum install kernel-uek-devel
If the above installs succeeded, try the Guest Additions installer once again:

And now you’re good to go. Now might be a good time to configure a shared folder from your host machine, and reboot to see if it works. Shared folders will appear at /media:

If these instructions did not help you, consider the pages below that provided helpful tips as I was troubleshooting the problem: