Install VirtualBox Additions on RHEL/CentOS 7.x

If you follow most of the documentation found here and there, your VirtualBox Additions installation will mostly be okay, excepted for OpenGL.

Errors like:

Building the OpenGL support module[FAILED]
(Look at /var/log/vboxadd-install.log to find out what went wrong. The module is not built but the others are.)

Inside the logfile, you’ll find something like:

echo >&2 "  ERROR: Kernel configuration is invalid.";        \
echo >&2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it.";    \
echo >&2 ;                            \
/bin/false)

Context

  • Red Hat 7 .x based OS (RHEL 7.2 here), like CentOS
  • VirtualBox 5.0.10

 

EPEL

If not already done, enable EPEL from https://fedoraproject.org/wiki/EPEL

rpm -ivh epel-release-latest-7.noarch.rpm

or CentOS:

yum install epel-release

Kernel Development Tools

We’ll need those to compile.

yum install kernel-devel kernel-headers gcc make

DKMS

If not already done, install Dynamic Kernel Module Support (DKMS):

yum install dkms

Build

export KERN_DIR=/usr/src/kernels/`uname -r`
export MAKE='/usr/bin/gmake -i'
cd /run/media/username/VBOXADDITIONS_5.0.10_104061/
./VBoxLinuxAdditions.run

Reboot and now you’re done.

One thought on “Install VirtualBox Additions on RHEL/CentOS 7.x”

Leave a comment