Vagrant Cheat Sheet

vagrant <cmd>

Commands:

box

provision

provisions the vagrant machine

push

deploys code in this environment to a configured destination

rdp

connects to machine via RDP

reload

restarts vagrant machine, loads new Vagrantfile configuration

resume

resume a suspended vagrant machine

share

share your Vagrant environment with anyone in the world

ssh

connects to machine via SSH

ssh-config

outputs OpenSSH valid configuration to connect to the machine

status

outputs status of the vagrant machine

suspend

suspends the machine

up

starts and provisions the vagrant environment

version

prints current and latest Vagrant version

manages boxes: installation, removal, etc.

connect

connect to a remotely shared Vagrant environment

destroy

stops and deletes all traces of the vagrant machine

global-status

outputs status Vagrant environments for this user

halt

stops the vagrant machine

help

shows the help for a subcommand

hostmanager

plugin: vagrant-hostmanager: manages the /etc/hosts file within a multi-machine environment

hosts

Information about hostnames managed by the vagrant-hosts plugin

init

initializes a new Vagrant environment by creating a Vagrantfile

login

log in to HashiCorp's Atlas

package

packages a running vagrant environment into a box

pe-build

Commands related to PE Installation

plugin

manages plugins: install, uninstall, update, etc.

In case of VBGuest errors (shared folders error)

in the Vagrantfile directory, run

vagrant plugin install vagrant-vbguest

on the vm guest run,

sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions

enable VBGuest auto update

vagrant gem install vagrant-vbguest

Or if you installed vagrant using RubyGems (gem install vagrant):

gem install vagrant-vbguest

vagrant plugin install vagrant-vbguest

vagrant vbguest

install vagrant plugin from a local gem

vagrant plugin install vagrant-vsphere --plugin-source vagrant-vsphere-1.13.0.gem

on guest (if centos)

yum install gcc kernel-devel make

Vagrant::Config.run do |config|

# set auto_update to false, if do NOT want to check the correct additions

# version when booting this machine

config.vbguest.auto_update = false

end

The location can be overridden with the iso_path parameter in your Vagrantfile, and can point to a http server

Vagrant::Config.run do |config|

config.vbguest.iso_path = "#{ENV['HOME']}/Downloads/VBoxGuestAdditions.iso"

# or

config.vbguest.iso_path = "http://company.server/VirtualBox/$VBOX_VERSION/VBoxGuestAdditions.iso"

end

Default paths for VBoxGuestAdditions

  • linux : /usr/share/virtualbox/VBoxGuestAdditions.iso

  • Mac : /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso

  • Windows : %PROGRAMFILES%/Oracle/VirtualBox/VBoxGuestAdditions.iso