среда, 16 мая 2012 г.

Custom vagrant image

1, start virtualbox and install your os
2. install ruby and chef
3, install http://download.virtualbox.org/virtualbox/4.2.6/VBoxGuestAdditions_4.2.6.iso
mount -o loop ./VBoxGuestAdditions_4.2.6.iso /mnt
run /mnt/VBoxLinuxAdditions.run --nox11
4. create user vagrant
5. download key https://github.com/mitchellh/vagrant/tree/master/keys/ and set to /home/vagrant/.ssh/authorized_keys
Also recheck permissions and selinux (chown -R vagrant:vagrant /home/vagrant/.ssh && chmod 700 /home/vagrant/.ssh && chmod 600 /home/vagrant/.ssh/authorized_keys && restorecon -R /home/vagrant/.ssh)
6. configure /etc/sudoers (comment Defaults requiretty and add vagrant as sudo user without password vagrant ALL=(ALL) NOPASSWD: ALL)
7. enable ssh
8. logout and poweroff guest vm
9. run vagrant package --base g2012 package.box
10. run vagrant box add g3 ./package.box
11. set g3 to your Vagrantfile to
config.vm.box = "g3"