3 | Step-by-Step Guide to Provision a Virtual Machine with Vagrant

Published: 27 April 2023
on channel: Automation Step by Step
11,113
127

🔥 All Free Tutorials - https://AutomationStepByStep.com/
Today we will learn:
What is meant by “Provision the VM”
How to Provision VM with Vagrant

This is a complete Beginner Tutorial
All notes and links in the Description

Provisioning a virtual machine means process of setting up and configuring a virtual machine with the necessary software and resources needed for a particular task or application
Settings on the VM to a desired state for a project or task

Provisioning can be done manually by logging into the VM and making the necessary changes, or
it can be automated using configuration management tools like Ansible, Chef, or Puppet
Automated provisioning can save time and ensure consistency across multiple VMs or environments
Vagrant allows for easy provisioning of VMs using configuration files called "Vagrantfiles" which specify the desired state of the VM

How to Provision the virtual machine

Can add the provision steps:
1. Within Vagrantfile
2. In a new file and provide location in Vagrantfile

Step 1 - Open Vagrantfile and add config.vm.provision block, add it to your Vagrantfile

Step 2 - Choose a provisioner. Vagrant supports several provisioners, including Shell, Ansible, Puppet, and Chef

config.vm.provision "shell", inline: <<-SHELL
Add your provisioning commands here
SHELL

Step 3 - Add the commands you need to setup the VM (Install, Update, Configure)
config.vm.provision "shell", inline: <<-SHELL
sudo apt-get update
sudo apt-get install apache2 -y
SHELL

Step 4 - Save Vagrantfile and start virtual machine vagrant up or vagrant reload (to restart machine)
Vagrant will read the Vagrantfile, and run the provisioning commands specified in the config.vm.provision block
From now onwards whenever you make any changes in the provision script can run command vagrant provision
This will only update the new changes (Ensure the VM is up when running this command)

Step 5 - Access your virtual machine vagrant ssh

Adding Provision script a new file and provide location in Vagrantfile:
To use Provision Script from external file:

Step 1 - Create a new file (e.g. provision.sh) and add the scripts to provision the VM

Step 2 - Provide location of the file Vagrantfile config.vm.provision :shell, path: "provision.sh"

Step 3 - If VM is already up can run the command vagrant provision

▬▬▬▬▬▬▬

Every Like & Subscription gives me great motivation to keep working for you
You can support my mission for education by sharing this knowledge and helping as many people as you can

If my work has helped you, consider helping any animal near you, in any way you can

Never Stop Learning
Raghav Pal


▬▬▬▬ USEFUL LINKS ▬▬▬▬

Ask Raghav - https://bit.ly/2CoJGWf

Shorts Eng - https://bit.ly/3H9bifV
Shorts Hindi - https://bit.ly/3XY7XqN

GitHub Repositories - https://github.com/Raghav-Pal
Udemy - https://automationstepbystep.com/udem...
Stories - https://automationstepbystep.com/stor...

▬▬ CI | CD | DEVOPS ▬▬
Jenkins Beginner - https://bit.ly/2MIn8EC
Jenkins Tips & Trick - https://bit.ly/2LRt6xC
Docker - https://bit.ly/2MInnzx
Jenkinsfile - https://bit.ly/3JSMSZ7
Kubernetes - http://bit.ly/2MJIlMK
Vagrant - https://bit.ly/3MVKdBt
Ansible - https://bit.ly/3MUsY3h

▬▬ UI TESTING ▬▬
Selenium Beginners - https://bit.ly/2MGRS8K
Selenium Java Framework from Scratch - https://bit.ly/2N9xvR6
Selenium Python - https://bit.ly/2oyMp5x
Selenium 4 - https://bit.ly/3AiJOlP
Selenium Tips - https://bit.ly/2owxc50
Selenium Builder - https://bit.ly/2MKNtlq
Katalon Studio - https://bit.ly/2wARFdi
Robot Framework with RIDE- https://bit.ly/2Px6Ue9
Robot Framework with Eclipse - http://bit.ly/2N8DZxb
Protractor - http://bit.ly/2KtqVkU
AccelQ - https://bit.ly/3PlsAsh
Test Project - http://bit.ly/2DRNJYE
Cucumber BDD - https://bit.ly/3Cnno4z
Cypress - https://bit.ly/3PpEukM
Playwright - https://bit.ly/3iuPByJ
WebdriverIO - https://bit.ly/3IJyofA
XPath & Web Locators - https://bit.ly/3PpEvoQ

▬▬ API TESTING ▬▬
Web Services (API) - https://bit.ly/2MGafL7
SoapUI - https://bit.ly/2MGahmd
Postman - https://bit.ly/3JWm4qX
Rest Assured - https://bit.ly/3zUdhRD
Karate API Testing - https://bit.ly/3w3H5Ku
General - https://bit.ly/2PYdwmV
JMeter API Testing - https://bit.ly/3AgVPar
Katalon Studio API Testing - https://bit.ly/2BwuCTN
API Mocking - https://bit.ly/3bYPsjS

▬▬ MOBILE TESTING ▬▬
Appium - https://bit.ly/2ZHFSGX
Mobile Playlist - https://bit.ly/2PxpeUv

▬▬ PERFORMANCE TESTING ▬▬
JMeter Beginner - https://bit.ly/2oBbtIU
Gatling - https://bit.ly/3QrWfkV
Performance Testing - https://bit.ly/2wEXbLS

▬▬ SOURCE CODE MANAGEMENT ▬▬
Git & GitHub - https://bit.ly/2Q1pagY
GITLAB - http://bit.ly/2kQPGyQ

▬▬ IDE ▬▬
Eclipse - https://bit.ly/3AnRhQP
IntelliJ IDEA - https://bit.ly/3AnyDZ8
Visual Studio Code - https://bit.ly/2V15yvt



Watch video 3 | Step-by-Step Guide to Provision a Virtual Machine with Vagrant online without registration, duration hours minute second in high quality. This video was added by user Automation Step by Step 27 April 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 11,113 once and liked it 127 people.