Vagrant
- This is a command line utility for managing virtual machines
- Usecases:
- To create developer environments
- On the laptop we have different options of creating virtual machines by using different hypervisor (vmware, virtual box, hyperv,kvm)
- vagrant give one command line interface to create virtual machines on different hypervisors
Manual creation of ubuntu instance in Hyper-V
- Hyper-V can be enabled on Windows 10 (> Home Edition)
- Ensure Hyper-V is enabled
- Terms:
- Host: Where hypervisor is installed
- Guest: VM created by hypervisor
Vagrant’s way of creating virtual machine
- Install Vagrant Refer Here
- Install chocolatey Refer Here
- Launch Powershell as admin and execute
choco install vagrant
- Create an empty directory and execute following commands
mkdir ubuntudemo
cd ubuntudemo
vagrant init generic/ubuntu1804
vagrant up --provider hyperv
- Once this command finishes execution a virtual machine will be created with ubuntu 18 os
- Lets login into the virtual machine. Generally the default credentials will be username: vagrant & password: vagrant
- deleting virtual machines is
vagrant destory
How Vagrant does that?
- For this we need to understand vagrant concepts
- Box
- Provider
- Shared Folders
- provisioning