Question: I am trying to install virtualbox5.2 on a RHEL 7 VM When I try to rebuild kernels modules I get the following error:

```
[root@myserver~]# /usr/lib/virtualbox/vboxdrv.sh setup
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
    kernel-devel kernel-devel-3.10.0-693.11.1.el7.x86_64

```

I tried install kernet-devel and got success message

```
Installed:
  kernel-devel.x86_64 0:3.10.0-693.21.1.el7                                     

Complete!

```

But still the setup fails.

Any idea what is missing here?

Answer: 
I got here looking for the same answer for CentOS 6, and the above answers worked with slight modification (so, for anyone else that lands here too)...

```
yum install -y kernel-devel kernel-devel-$(uname -r)

```

So, "yum" instead of "apt-get"
Also, some Linux use "linux-headers" instead of "kernel-devel" but the principle seems to be the same.
A little late to the party but I just ran into this problem myself and here's what I did to resolve the issue.

```
yum update -y
yum install -y redhat-lsb-core net-tools kernel-headers kernel-devel epel-release
yum groupinstall -y "Development Tools"
reboot

```

Ensure your system has been fully updated when you ran yum update -y before continuing!

Cheers