Vagrant

Here is your Vagrant Cheat-Sheet with additional sections included:


🛡️ Vagrant Cheat-Sheet

Vagrant is an open-source tool for building and maintaining virtualized development environments. It provides a consistent workflow for managing virtual machines (VMs) across multiple platforms. Below is a cheat-sheet with essential Vagrant commands for general management, VM provisioning, and box management.


🔍 Overview

  • Product Type: Virtual Machine Management Tool

  • Focus: Streamlining the process of creating and managing reproducible development environments.


🧠 General Management

COMMANDDESCRIPTION
vagrant statusOutputs the status of the current Vagrant machine
vagrant global-statusOutputs the status of all Vagrant machines
vagrant global-status --prunePrunes invalid entries from the global status list

🖥️ Managing VMs

COMMANDDESCRIPTION
vagrant initInitializes Vagrant with a Vagrantfile and .vagrant directory (requires specifying a base image in the Vagrantfile before running vagrant up)
vagrant upStarts the Vagrant environment (provisions only on the first vagrant up)
vagrant haltStops the Vagrant machine
vagrant suspendSuspends the virtual machine, saving its state
vagrant resumeResumes a suspended machine (can also use vagrant up for this)
vagrant sshConnects to the machine via SSH
vagrant ssh <BOXNAME>SSH into a specific box by name (useful if you have named the box in your Vagrantfile)
vagrant destroyStops and deletes the Vagrant machine, removing all traces
vagrant destroy -fSame as above, but skips the confirmation prompt

⚙️ Provisioning VMs

COMMANDDESCRIPTION
vagrant provisionForces reprovisioning of the Vagrant machine
vagrant provision --debugEnables debug mode for more detailed provisioning output
`vagrant up --provisiontee provision.log`

📦 Manage Boxes

COMMANDDESCRIPTION
vagrant box listLists all installed Vagrant boxes on your computer
vagrant box add <BOXNAME> <BOXURL>Downloads and adds a box image to your machine
vagrant box outdatedChecks for updates for the installed boxes
vagrant box remove <BOXNAME>Removes a specific box from the machine
vagrant packagePackages a running VirtualBox environment into a reusable box

🌐 Vagrant with WSL2

Vagrant can also be run inside your Windows Subsystem for Linux (WSL2) environment. This allows you to leverage Vagrant's features directly within a Linux-like environment on Windows. For a tutorial on installing and using Vagrant with WSL2 and VirtualBox, check out this guide.

For more advanced usage with Vagrant and VirtualBox, refer to the official Vagrant Documentation.


  • Zero Trust Security

  • Cloud Security Posture Management

  • XDR

  • Firewalls

  • SASE


🏷️ Tags

#vagrant
#virtualization
#dev-environment
#vm-management
#wsl2
#vagrant-boxes
#provisioning


You can explore more Vagrant-related topics here: