vagrant init
: createsVagrantfile
in current directoryvagrant box add <environment>
: add box to environment (e.g.hashicorp/precise32
). Find more boxes at HashiCorp's Atlas box catalogvagrant ssh
: login to vmvagrant status
andvagrant global-status
: see which vm's are running locally and globallyvagrant reload
: reload vmvagrant suspend
: save the current running state of vm and stop it.vagrant halt
: gracefully shut down OS and power downvagrant destroy
: remove all traces of the vm from system
Files synced in /vagrant/
folder on vm and in same directory as Vagrantfile
on host.
After creating environment and optional shell script (e.g. bootstrap.sh
), open the Vagrantfile
and modify the following:
Vagrant.configure("2") do |config|
config.vm.box = "<environment>"
config.vm.provision :shell, path: "bootstrap.sh"
end
If the guest machine is already running from a previous step, run:
$ vagrant reload --provision
Update apt-get
$ sudo apt-get update
start vm
$ VBoxHeadless --startvm "vm-name" &
# or
$ VBoxManage startvm "vm-name" --type headless
create vm
$ VBoxManage createvm --name "vm-name"
power off vm
$ VBoxManage controlvm "vm-name" poweroff
verify extension pack is installed in order to use VirtualBox headless
$ VBoxManage list extpacks