Vagrant Reference - Oliver-Mustoe/Oliver-Mustoe-Tech-Journal GitHub Wiki

Vagrant reference (mostly working in nixos tho...) and the provider used throughout is libvirt

Document uses Ubuntu 22.04 as an example

Getting vagrant box up & sshing inside it

mkdir vagrant-host-location-folder
cd vagrant-host-location-folder
# Check list of vagrant box applicable hosts here https://portal.cloud.hashicorp.com/vagrant/discover?providers=libvirt&query=
vagrant init generic/ubuntu2204
vagrant up --provider=libvirt
vagrant ssh

Stopping Vagrant box

vagrant halt

Completely getting rid of a box (once halted!)

# Grab the id
vagrant global-status
# Destroy the id
vagrant destroy <id>
# If the above does not work for you, delete the image manually in /var/lib/libvirt/images/
# ls -l /var/lib/libvirt/images/
# sudo rm /var/lib/libvirt/images/<image name, should match the version you downloaded!>
vagrant global-status -prune
# Should not have the VM you destroyed in the output anymore!
vagrant global-status

Sources