Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bennythejudge/1e161db32328b78f6c8b1d287bf78176 to your computer and use it in GitHub Desktop.
Save bennythejudge/1e161db32328b78f6c8b1d287bf78176 to your computer and use it in GitHub Desktop.
How to update VirtualBox Guest Additions with vagrant (updated to VirtualBox 5.1.24)
# Use centos/7
$ vagrant init centos/7
$ vagrant up
# You should see a message like:
# [default] The guest additions on this VM do not match the install version of
# VirtualBox! This may cause things such as forwarded ports, shared
# folders, and more to not work properly. If any of those things fail on
# this machine, please update the guest additions and repackage the
# box.
#
# Guest Additions Version: 5.1.24
# VirtualBox Version: 5.1.24
########################################################################################################
## ATTENTION:
## Make sure you use the version of Guest Additions that match your VirtualBox version
## When following this gist in the future, the version referenced above will be obsolete.
$ vagrant ssh
vagrantup:~$ sudo yum -y update
vagrantup:~$ cd /opt
# replacing the version so that you are forced to change it and use the correct one
vagrantup:~$ sudo wget -c http://download.virtualbox.org/virtualbox/4.2.8/VBoxGuestAdditions_x.y.z.iso \
-O VBoxGuestAdditions_x.y.z.iso
vagrantup:~$ sudo mount VBoxGuestAdditions_x.y.z.iso -o loop /mnt
vagrantup:~$ cd /mnt
vagrantup:~$ sudo sh VBoxLinuxAdditions.run --nox11
vagrantup:~$ cd /opt
vagrantup:~$ sudo rm *.iso
vagrantup:~$ sudo /etc/init.d/vboxadd setup
vagrantup:~$ sudo chkconfig --add vboxadd
vagrantup:~$ sudo chkconfig vboxadd on
vagrantup:~$ exit
# Now check that the Guest Additions work
$ vagrant halt
$ vagrant up
# Package the new VM
$ vagrant halt
$ vagrant package
$ mv package.box centos-x.y.box
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment