Skip to content

Instantly share code, notes, and snippets.

@23jodys
Created April 27, 2018 18:55
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 23jodys/cf193ec126efb4908f0b93a7c8d55c28 to your computer and use it in GitHub Desktop.
Save 23jodys/cf193ec126efb4908f0b93a7c8d55c28 to your computer and use it in GitHub Desktop.
Building vagrant box from existing box with VMWare fusions
vagrant init <base box>
vagrant up
vagrant ssh
# Do your customizations here
# yum -y install blah blah
# don't forget to clean up, yum clean all
# Reset the insecure key
dd if=/dev/zero of=/EMPTY bs=1M; rm -f /EMPTY
curl https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub > ~/.ssh/authorized_keys
exit
vagrant halt
cd .vagrant/machines/default/vmware_fusion/<UUID>/
echo "{\"provider\": \"vmware_fusion\"}" > metadata.json
/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager -d *.vmdk
/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager -k *.vmdk
tar czvf ~/mybox.box ./*
vagrant box add mybox.box --name mine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment