@its_me's answer almost worked, but it failed building some kernel modules.
If it doesn't work for you, look at the messages.
In my case, one of them asked to look into /var/log/vboxadd-install.log
. There it said something about missing kernel sources and to provide the kernel source directory with e.g. KERN_DIR=/path/to/kernel/sources
.
Since kernel-devel
and sources at /usr/src/kernels/2.6.32-504.16.2.el6.x86_64
were already installed, I was confused, but called it with the requested environment variable
KERN_DIR=/usr/src/kernels/2.6.32-504.16.2.el6.x86_64 sh /media/cdrom/VBoxLinuxAdditions.run
Now it complained about missing header files and suggested to do
yum install kernel-devel-2.6.32-504.el6.x86_64
As you can see, this is a slightly different version, 504.16.2
vs just 504
. After installing the proper kernel-devel
package, building and then installing worked as expected.
So, running kernel and installed kernel sources (aka kernel-devel
) must match. You can verify this by looking at the running kernel with
uname -a
and the installed sources at
ls /usr/src/kernels
As a final conclusion, whatever happens, look at the messages and log files provided.
yum install make
as well – nic ferrier Feb 06 '12 at 12:23sudo mkdir /media/cdrom
. – Anthon Jun 10 '13 at 20:27yum install dkms
too. Was getting no output at all when running./VBoxLinuxAdditions.run
. – ficuscr Aug 30 '13 at 03:06sh /media/cdrom/VBoxLinuxAdditions.run
. I also had to install Perl (yum install perl
) and create the mount-point (sudo mkdir -p /media/cdrom
). – smholloway Nov 11 '13 at 16:18/dev/scd0
but instead at/dev/sr0
– isapir Mar 14 '16 at 04:15VBoxLinuxAdditions.run
to be actually available. – alekosot Nov 18 '16 at 18:23sudo yum install kernel-headers
and when executing the install,KERN_DIR=/usr/src/kernels/2.6.32-504.16.2.el6.x86_64 sudo /media/cdrom/VBoxLinuxAdditions.run
.EXPORT
ing theKERN_DIR
did not work. But alas, I was able to install this. :/ – juice Dec 02 '16 at 01:45ssh
), you can download anISO
of the guest additions for any version fromhttp://download.virtualbox.org/virtualbox
– jxmallett Feb 03 '17 at 03:29vagrant
, check out the vagrant-vbguest plugin. – jxmallett Feb 03 '17 at 04:05wget
e.g.wget https://download.virtualbox.org/virtualbox/5.2.18/VBoxGuestAdditions_5.2.18.iso
(but choose the right version number) and then mount the iso withmount -t iso9660 -o loop VBoxGuestAdditions_5.2.18.iso /mnt/cdrom
– Mark Ch Oct 01 '18 at 06:42