#Vagrant
Creates and downloads if necesary a vm with Ubuntu 12.04 LTS
vagrant init hashicorp/precise32
Runs the VM of current directory
vagrant up
To check the status of a vm:
vagrant status
To stop the VM
vagrant halt
Stops the VM and starts it again
vagrant reload
Suspend VM stores guest RAM on host disk and frees the resources
vagrant suspend
To restore the suspended VM
vagrant resume
Connects to current directory vm
vagrant ssh
To delete the VM
vagrant destroy
Prints current running vms
vboxmanage list runningvms
##Vagrantfile To not run headless, uncomment
vb.gui = true
This will open a Virtual Box window when running the vm, the user and password are vagrant
To forward ports from guest to host
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network "forwarded_port", guest: 80, host: 8080, id: "nginx", guest_ip: "X.X.X.X", host_ip: "X.X.X.X", protocol: "udp", auto_correct: true
Auto correct parameter fixes protocol collisions
###Provisioning To declare provisions on Vagrant file:
config.vm.provision "shell", path: "provision.sh"
Provisions are called on VM creation, but not subsecuent calls (ups), to force them use:
vagrant provision