Skip to content

Instantly share code, notes, and snippets.

@jonasschultzmblox
Last active May 12, 2023 07:59
Show Gist options
  • Save jonasschultzmblox/f15fe3c10769d5f269635a54394c84d4 to your computer and use it in GitHub Desktop.
Save jonasschultzmblox/f15fe3c10769d5f269635a54394c84d4 to your computer and use it in GitHub Desktop.
#!/bin/bash
#Heavily inspired by clivewalkden/centos-7-package.sh
# ( https://gist.github.com/clivewalkden/b4df0074fc3a84f5bc0a39dc4b344c57 )
#However, this one was tested... 2017-JAN-09
vagrant init centos/7
vagrant up
vagrant ssh -c "sudo yum -y update"
vagrant ssh -c "sudo yum -y install wget nano kernel-devel gcc"
vagrant ssh -c "sudo cd /opt && sudo wget http://download.virtualbox.org/virtualbox/5.1.12/VBoxGuestAdditions_5.1.12.iso -O /opt/VBGAdd.iso"
vagrant ssh -c "sudo mount /opt/VBGAdd.iso -o loop /mnt"
vagrant ssh -c "sudo sh /mnt/VBoxLinuxAdditions.run --nox11"
vagrant ssh -c "sudo umount /mnt"
vagrant ssh -c "sudo rm /opt/VBGAdd.iso"
#Check that we can halt and boot
vagrant halt
vagrant up
#Halt again and package
vagrant halt
vagrant package
#And finally, clean up
mv package.box centos7vb.box
rm Vagrantfile
@Zeebrow
Copy link

Zeebrow commented Jun 9, 2019

FYI - if you need the latest version of the guest additions is available in the repo:

sudo yum -y install wget
cd /opt/
sudo wget http://download.virtualbox.org/virtualbox/LATEST.TXT
sudo wget -c http://download.virtualbox.org/virtualbox/$(cat LATEST.TXT)/VBoxGuestAdditions_$(cat LATEST.TXT).iso

Above might not be the best syntax, I dunno. Anyways, IMO, it feels a bit cleaner to grab the version info from the same repo that we're wget-ing from.There's also a LATEST-STABLE.TXT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment