Introduction
HarshiCorp promises that Vagrant is a tool for building and managing virtual machine environments in a single workflow. 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. In this guide you will learn to install Vagrant on Windows 10.
Please note that the Hyper-V provider is compatible with Windows 8.1 and later only. Prior versions of Hyper-V do not include the necessary APIs for Vagrant to work.
If you have Hyper-V installed and SMB enabled, you can skip Step 1.
Step 1: Enable Hyper-V and SMB
Follow the steps below to enable Hyper-V and SMB on your Windows machine.
Search for Control Panel
Hit Windows key and search for “Control Panel“. Launch it when it comes up.
Click on Programs
Click on “Turn Windows features on or off”
Scroll down, look for “Hyper-V” and expand it.
Check both Hyper-V Management Tools and Hyper-V Platform then click “OK” as shown above.
Look for SMB 1.0/CIFS File Sharing Support and check it.
Restart your computer
If you like PowerShell simply run the following commands. Ensure you are running Powershell as Administrator:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
Enable-WindowsOptionalFeature -Online -FeatureName "SMB1Protocol" -All
Step 2: Install Executable File
Navigate to the folder you downloaded your Vagrant executable file and double-click on it to start the installation process.
Step 3: Follow the Installation Steps
Follow the screenshots below to install Vagrant
If you get a message like below, simply click on “More info“
Then “Run it anyway”
That should open an installation wizard as shown below. Simply follow the “Next” steps as you make configurations depending on what you want
Accept terms in the License Agreement and click “Next“
You can choose to install Vagrant in a different location here if it suits your requirements.
Click “Install” to begin the installation process.
After everything is done installing, the wizard should end as shown below. Simply click “Finish” to complete this phase of work.
Step 4: Restart Computer
Once you’ve completed setup steps, restart your computer for the changes to take effect.
Step 5: Adding our First Vagrant Box
Boxes are the package format for Vagrant environments. A box can be used by anyone on any platform that Vagrant supports to bring up an identical working environment. The easiest way to use a box is to add a box from the publicly available catalog of Vagrant boxes. You can also add and share your own customized boxes on this website.
Fire up your Powershell as Administrator and enter the commands below:
vagrant box add hashicorp/bionic64
That will get us a Standard Ubuntu 18.04 LTS 64-bit box
Confirm later with the command below
vagrant box list
After the download is done, navigate to a folder you would wish to keep Vagrantfile and run the command below.
vagrant init hashicorp/bionic64
To bring the Virtual Machine up, run the command below in your PowerShell
vagrant up --provider hyperv
You can then connect to your VM using
vagrant ssh
Our Virtual Machine should now be seen in Hyper-V Manager as shown below
Conclusion
We have successfully enabled Hyper-V, installed Vagrant and launched our Virtual Machine. We thank you for visiting and following through the guide.
Other related guides are shared below for your consideration in case you would wish to run Vagrant in a different environment.
How To Install Vagrant on CentOS 8 / RHEL 8
How To Use Vagrant with Libvirt on Linux
Run CentOS 8 VM using Vagrant on KVM / VirtualBox / VMWare / Parallels
How To Install Vagrant and VirtualBox on Fedora
How To run Kali Linux on VirtualBox with Vagrant
How To run Kali Linux on VirtualBox with Vagrant