LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

vagrant

Manage portable virtual development environments

TLDR

Initialize new Vagrantfile
$ vagrant init [ubuntu/jammy64]
copy
Start and provision VM
$ vagrant up
copy
SSH into VM
$ vagrant ssh
copy
Stop VM
$ vagrant halt
copy
Destroy VM
$ vagrant destroy
copy
Show VM status
$ vagrant status
copy
Reload VM (restart with new config)
$ vagrant reload
copy
List boxes
$ vagrant box list
copy

SYNOPSIS

vagrant command [options]

DESCRIPTION

vagrant manages virtual development environments. It automates VM creation, configuration, and provisioning.Vagrantfile defines the VM configuration. It specifies the base box, network settings, shared folders, and provisioning scripts.Boxes are base images. Many are available from Vagrant Cloud. Custom boxes can be created and shared.Providers handle virtualization. VirtualBox is default, with support for VMware, Hyper-V, Docker, and cloud providers.Provisioners configure VMs after boot. Shell scripts, Ansible, Puppet, and Chef are supported.Multi-machine setups define several VMs in one Vagrantfile. They can model complex environments like clusters.

PARAMETERS

init [BOX]

Initialize a new Vagrantfile, optionally with a specified base box.
up [NAME]
Start and provision the VM. Optionally specify a machine name in multi-machine setups.
ssh [NAME]
SSH into a running VM.
halt [NAME]
Gracefully stop a running VM.
destroy [NAME]
Remove a VM and all its resources.
reload [NAME]
Restart a VM and reload Vagrantfile configuration.
suspend [NAME]
Pause a running VM, saving its current state.
resume [NAME]
Resume a previously suspended VM.
provision [NAME]
Run configured provisioners on a running VM.
status [NAME]
Show the status of VMs in the current environment.
global-status
Show the status of all Vagrant VMs across the system.
snapshot push
Save a snapshot of the current VM state.
snapshot pop
Restore the most recent snapshot.
validate
Check the Vagrantfile for syntax errors.
package
Package a running VM into a reusable box.
plugin install NAME
Install a Vagrant plugin.
box add BOX
Download and add a box image.
box list
List locally available boxes.
box remove BOX
Remove a locally stored box.
--provider NAME
Specify the provider (virtualbox, vmware, etc.).
-f, --force
Force the operation without confirmation.
-h, --help
Display help information for any command.

CAVEATS

Requires virtualization software. Large boxes need download time and disk space. Provider-specific features may vary.

HISTORY

Vagrant was created by Mitchell Hashimoto in 2010 and later developed by HashiCorp. It revolutionized development environment management, enabling reproducible setups.

SEE ALSO

vboxmanage(1), docker(1), ansible(1), packer(1), ssh(1)

Copied to clipboard
Kai