Hello everyone. In this article, I will guide you through the basics of using Vagrant.
I. What is Vagrant?
Vagrant is a tool for building and managing virtual machine environments in a single workflow. With an easy-to-use workflow and a focus on automation, Vagrant reduces development environment setup time, increases equivalent output, and makes “work on my machine” a relic of the past.
You can understand that Vagrant creates a configuration file and deploys a virtual machine with just a few simple command lines instead of opening applications like VMWare, Virtualbox, HyperV, … performing a series of creation operations. a virtual machine. Vagrant also makes changing the parameters of the virtual machine much simpler than manually configuring it.
Vagrant plays a support role for applications: VMWare, Virtualbox, HyperV, … so to use, you will need to install those applications first.
II. Install Vagrant
2.1. Install on Windows
On a Windows environment I will use Virtualbox and Git to run with Vagrant. When running virtual machines with Vagrant, the virtual machines will run in the background, so you don’t need to open Virtualbox, but the virtual machine can still work normally.
Step 1: Go to Vagrant homepage vagrantup.com/downloads and select the version for Windows to install.
Step 2: Create a directory for the virtual machine
Step 3: Go to app.vagrantup.com/boxes/search and select the image you want to install.
The options network, provider, provision can be left by default without configuration.
2.2. Install on Ubuntu
On Ubuntu environment do the installation using the command
sudo apt-get install vagrant
II. Commonly used basic commands
vagrant [options] <command> [<args>]
Run virtual machine
Shutdown virtual machine
Flying color virtual machine
Restart the virtual machine and update the configuration according to the new Vagrantfile
Suspend the virtual machine
Resume suspended virtual machine
Check virtual machine status in current folder
SSH into the virtual machine
Check all running virtual machines
Make a snapshot
vagrant snapshot save level1
Check out snapshots
vagrant snapshot list
Delete the snapshot
vagrant snapshot delete level1
vagrant snapshot restore level1
Check vagrant version
Show all support commands
Thank you all for reading my post and when you’re done, please give me your feedback. The following article is better thanks to your feedback. If you find this post useful, give me an upvote. I thank you.