Install Vagrant: https://www.vagrantup.com/downloads.html
Install Oracle Virtual Box: https://www.virtualbox.org/
In a new Directory/folder on your desktop named workshop
cd Desktop
mkdir workshop
go into the workshiop folder and create new folder named vagrantvm
mkdir vagrantvm
cd vagrantvm
Initialize the VM using vagrant init, it will create Vagrantfile
vagrant init bento/ubuntu-18.04
ls
open Vagrantfile
notepad Vagrantfile
and add following lines below config.vm.box = "bento/ubuntu-18.04"
config.vm.hostname = "vm1"
config.vm.network "private_network", ip: "172.16.1.10"
final content should look like
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-18.04"
config.vm.hostname = "vm1"
config.vm.network "private_network", ip: "172.16.1.10"
end
finally save content
Start VM
vagrant up
Note: for first time it will take lot of time to boot up VM as it has to download image file.
SSH into the VM
vagrant ssh
Stop VM
vagrant halt