Vagrant
Install Vagrant
To use Vagrant, you will need to install it. HashiCorp distributes Vagrant as a binary package. You can also install Vagrant using popular package managers.
Install binary
Retrieve the vagrant
binary by downloading a pre-compiled binary. To install Vagrant, find the appropriate package for your system and download it as a zip archive.
After downloading Vagrant, unzip the package. Vagrant runs as a single binary named vagrant
. You can safely remove any other files in the package and Vagrant will still function.
Finally, make sure that the vagrant
binary is available on your PATH
. This process will differ depending on your operating system.
Print a colon-separated list of locations in your PATH
.
$ echo $PATH
Move the Vagrant binary to one of the listed locations. This command assumes that the binary is currently in your downloads folder and that your PATH
includes /usr/local/bin
, but you can customize it if your locations are different.
$ mv ~/Downloads/vagrant /usr/local/bin/
For more detail about adding binaries to your path, see this Stack Overflow article.
Verify the installation
Verify that the installation worked by opening a new terminal session and listing Vagrant's available subcommands.
$ vagrant --help
Usage: vagrant [options] <command> [<args>]
-h, --help Print this help.
Common commands:
autocomplete manages autocomplete installation on host
box manages boxes: installation, removal, etc.
cloud manages everything related to Vagrant Cloud
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
init initializes a new Vagrant environment by creating a Vagrantfile
login
package packages a running vagrant environment into a box
plugin manages plugins: install, uninstall, update, etc.
port displays information about guest port mappings
powershell connects to machine via powershell remoting
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
serve start Vagrant server
snapshot manages snapshots: saving, restoring, etc.
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
upload upload to machine via communicator
validate validates the Vagrantfile
version prints current and latest Vagrant version
winrm executes commands on a machine via WinRM
winrm-config outputs WinRM configuration to connect to the machine
For help on any individual command run `vagrant COMMAND -h`
Additional subcommands are available, but are either more advanced
or not commonly used. To see all subcommands, run the command
`vagrant list-commands`.
--[no-]color Enable or disable color output
--machine-readable Enable machine readable output
-v, --version Display Vagrant version
--debug Enable debug output
--timestamp Enable timestamps on log output
--debug-timestamp Enable debug output with timestamps
--no-tty Enable non-interactive output
Add any subcommand to vagrant --help
to learn more about what it does and available options.
$ vagrant up --help
Usage: vagrant up [options] [name|id]
Options:
--[no-]provision Enable or disable provisioning
--provision-with x,y,z Enable only certain provisioners, by type or by name.
--[no-]destroy-on-error Destroy machine if any fatal error happens (default to true)
--[no-]parallel Enable or disable parallelism if provider supports it
--provider PROVIDER Back the machine with a specific provider
--[no-]install-provider If possible, install the provider if it isn't installed
--[no-]color Enable or disable color output
--machine-readable Enable machine readable output
-v, --version Display Vagrant version
--debug Enable debug output
--timestamp Enable timestamps on log output
--debug-timestamp Enable debug output with timestamps
--no-tty Enable non-interactive output
-h, --help Print this help
If you get an error that the binary could not be found, then you likely did not properly set up your PATH
environment variable. Ensure that your PATH variable contains the directory where you installed Vagrant.
Next steps
Now that you have installed Vagrant locally, continue to the next tutorial to write your first Vagrantfile and create your development environment with Vagrant.