Hello folks, recently I ran on this error while installing virtualbox on Red Hat 6. It will probably work for Oracle Linux/Centos as well. The reason you are receiving this error message is probably because of missing packages, such as kernel-devel, headers or gcc.
To solve this, open a terminal and logon as root (replace the kernel folder below in red according to your system):
# /etc/init.d/vboxdrv stop # yum -y install kernel-devel # yum -y install kernel-headers.x86_64 # yum -y install gcc.x86_64 # export KERN_DIR=/usr/src/kernels/2.6.32-573.26.1.el6.x86_64/ # /etc/init.d/vboxdrv setup # /etc/init.d/vboxdrv start
Notice that if you still get errors, you’ll be able to troubleshoot them by simply reviewing the log generated every time you run the setup command.