LinuxCommandLibrary

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 [up] [ssh] [halt] [destroy] [status] [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 Vagrantfile.
up
Start and provision VM.
ssh [NAME]
SSH into VM.
halt
Stop VM.
destroy
Remove VM.
reload
Restart VM with config.
provision
Run provisioners.
status
Show VM status.
global-status
All Vagrant VMs.
box add BOX
Add box.
box list
List boxes.
box remove BOX
Remove box.
--provider NAME
Provider (virtualbox, vmware, etc.).
-f, --force
Force operation.

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

virtualbox(1), docker(1), ansible(1), packer(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community