How do I install VirtualBox guest additions for CentOS 7?
Solution 1:
vagrant init centos/7
vagrant up; vagrant halt
- Add a CDROM to the virtual machine and select the
VBoxGuestAdditions.iso
file to insert in the drive.
- Manually add a shared folder in VirtualBox with name
vagrant
and path to the directory of yourVagrantfile
. Vagrant doesn't set up /vagrant properly.
-
Edit
Vagrantfile
and add this to the bottom to provision the shared folder each time you start.config.vm.provision "shell", run: "always", inline: <<-SHELL mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant SHELL
-
Continue with
vagrant up vagrant ssh sudo yum update sudo yum install kernel-devel gcc exit vagrant halt; vagrant up; vagrant ssh export KERN_DIR=/usr/src/kernels/`uname -r` sudo mount /dev/sr0/ /mnt cd /mnt sudo ./VBoxLinuxAdditions.run
Solution 2:
$ cat /var/log/vboxadd-install.log
/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.
Your install.log file is very clear: you need to install the headers,
sudo yum update
sudo yum install kernel-headers kernel-devel
and then you may re-install VirtualBox.