2025-03-14 21:59:59 -06:00
|
|
|
# vagrant
|
|
|
|
|
|
|
|
|
|
> Manage lightweight, reproducible, and portable development environments.
|
2025-09-14 18:48:49 -06:00
|
|
|
> Some subcommands such as `box`, `snapshot`, `halt`, etc. have their own usage documentation.
|
|
|
|
|
> More information: <https://developer.hashicorp.com/vagrant/docs/cli>.
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-09-14 18:48:49 -06:00
|
|
|
- Create a `Vagrantfile` in the current directory with the base Vagrant box:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
`vagrant init`
|
|
|
|
|
|
2025-09-14 18:48:49 -06:00
|
|
|
- Create a `Vagrantfile` with a box from the Vagrant Public Registry:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-09-14 18:48:49 -06:00
|
|
|
`vagrant init {{ubuntu/focal64}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-09-14 18:48:49 -06:00
|
|
|
- Start and provision the Vagrant environment:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
`vagrant up`
|
|
|
|
|
|
|
|
|
|
- Suspend the machine:
|
|
|
|
|
|
|
|
|
|
`vagrant suspend`
|
|
|
|
|
|
|
|
|
|
- Halt the machine:
|
|
|
|
|
|
|
|
|
|
`vagrant halt`
|
|
|
|
|
|
2025-09-14 18:48:49 -06:00
|
|
|
- Connect to the machine via SSH:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
`vagrant ssh`
|
|
|
|
|
|
|
|
|
|
- Output the SSH configuration file of the running Vagrant machine:
|
|
|
|
|
|
|
|
|
|
`vagrant ssh-config`
|
|
|
|
|
|
|
|
|
|
- List all local boxes:
|
|
|
|
|
|
|
|
|
|
`vagrant box list`
|