Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tuxfight3r/5d05b058a8c5204b9549c6246d431ceb to your computer and use it in GitHub Desktop.
Save tuxfight3r/5d05b058a8c5204b9549c6246d431ceb to your computer and use it in GitHub Desktop.
How to update VirtualBox Guest Additions with vagrant
# Start the old vagrant
$ vagrant init centos/7
$ vagrant up
$ vagrant ssh
vagrantup:~$ sudo yum -y install wget kernel-devel kernel-headers gcc
vagrantup:~$ sudo yum -y update & reboot
vagrantup:~$ sudo wget -c http://download.virtualbox.org/virtualbox/5.2.12/VBoxGuestAdditions_5.2.12.iso \
-O VBoxGuestAdditions_5.2.12.iso
vagrantup:~$ sudo mount VBoxGuestAdditions_5.2.12.iso -o loop /mnt
vagrantup:~$ cd /mnt
vagrantup:~$ sudo sh VBoxLinuxAdditions.run
vagrantup:~$ echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" > ~/.ssh/authorized_keys
vagrantup:~$ exit
# Now check that the Guest Additions work
$ vagrant halt
$ vagrant up
$ vagrant ssh
vagrantup:~$ sudo systemctl status vboxadd
# Package the new VM
$ vagrant halt
$ vagrant package
$ mv package.box centos-7.box
$ vagrant box add centos7-latest centos-7.box
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment