In a nutshell, Vagrant is a tool for working with virtual environments, and in most circumstances, this means working with virtual machines. Vagrant provides a simple and easy to use command-line client for managing these environments, and an interpreter for the text-based definitions of what each environment looks like, called Vagrantfiles. Vagrant is open source, which means that anyone can download it, modify it, and share it freely.
With an easy-to-use workflow and focus on automation, Vagrant lowers development environment setup time, increases production parity, and makes the "works on my machine" excuse a relic of the past.
While many virtual machine hypervisors provide their own command-line interface, and technically the provisioning of virtual machines through these programs can be done directly or through shell scripts, the advantage Vagrant provides by adding an additional layer is simplicity, interoperability across multiple systems, and a more consistent approach which could theoretically be used with any virtual environment running on top of any other system.
Vagrant is designed for everyone as the easiest and fastest way to create a virtualized environment.
To download Vagrant head over to vagrantup.com click on the latest version and download the correct version for your operating system.
If you wish to use VirtualBox on Windows, you must ensure that Hyper-V is not enabled on Windows. You can turn off the feature by running this Powershell command as administrator:
Or you can also disable it by going through the Windows system settings:
Right click on the Windows button and select ‘Apps and Features’;
Select Turn Windows Features on or off;
Unselect Hyper-V and click OK.
You might have to reboot your machine for the changes to take effect.
Once you have downloaded Vagrant, run the executable and just click next, next, next, until the software has been installed.
Once Vagrant is installed you need to open your terminal or cmd window and just type vagrant --version to check if the installation is ok, It should return the version that you downloaded.
So we now have Vagrant installed.
>>> BONUS TIME:
This is the command used to manage (add, remove, etc.) boxes into Vagrant:
If you now type the command vagrant box list you should see the image added:
This initializes the current directory to be a Vagrant environment by creating an initial Vagrantfile if one does not already exist:
This vagrantfile contains all the information about your environment but at this stage it only contains one line config.vm.box:
Type vagrant up to start your box:
Note: I usually use a VirtualBox but you can use any other.
This command shutdown the running machine:
You need to do several other settings after this, but I'll leave it for an other post.