2015-12-23 15:02:45 +02:00
|
|
|
# vagrant
|
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
> Manage lightweight, reproducible, and portable development environments.
|
2025-08-03 02:34:41 +10:00
|
|
|
> Some subcommands such as `box`, `snapshot`, `halt`, etc. have their own usage documentation.
|
|
|
|
> More information: <https://developer.hashicorp.com/vagrant/docs/cli>.
|
2015-12-23 15:02:45 +02:00
|
|
|
|
2025-08-03 02:34:41 +10:00
|
|
|
- Create a `Vagrantfile` in the current directory with the base Vagrant box:
|
2015-12-23 15:02:45 +02:00
|
|
|
|
|
|
|
`vagrant init`
|
|
|
|
|
2025-08-03 02:34:41 +10:00
|
|
|
- Create a `Vagrantfile` with a box from the Vagrant Public Registry:
|
2015-12-23 15:02:45 +02:00
|
|
|
|
2025-08-03 02:34:41 +10:00
|
|
|
`vagrant init {{ubuntu/focal64}}`
|
2015-12-23 15:02:45 +02:00
|
|
|
|
2025-08-03 02:34:41 +10:00
|
|
|
- Start and provision the Vagrant environment:
|
2015-12-23 15:02:45 +02:00
|
|
|
|
|
|
|
`vagrant up`
|
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- Suspend the machine:
|
2015-12-23 15:02:45 +02:00
|
|
|
|
|
|
|
`vagrant suspend`
|
|
|
|
|
2019-04-30 15:52:55 +08:00
|
|
|
- Halt the machine:
|
|
|
|
|
|
|
|
`vagrant halt`
|
|
|
|
|
2025-08-03 02:34:41 +10:00
|
|
|
- Connect to the machine via SSH:
|
2015-12-23 15:02:45 +02:00
|
|
|
|
|
|
|
`vagrant ssh`
|
2020-09-25 14:35:24 +08:00
|
|
|
|
|
|
|
- Output the SSH configuration file of the running Vagrant machine:
|
|
|
|
|
|
|
|
`vagrant ssh-config`
|
2022-02-23 22:33:19 +08:00
|
|
|
|
|
|
|
- List all local boxes:
|
|
|
|
|
|
|
|
`vagrant box list`
|