Enable Hyper-V and Install Vagrant on Windows 10|11

Posted on 135 views

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.

hyper-v-1-control-panel-1-696x354

Click on Programs

hyper-v-2-click-programs-1-696x428

Click on “Turn Windows features on or off”

hyper-v-3-turn-on-off-features-1-696x385

Scroll down, look for “Hyper-V” and expand it.

hyper-v-4-check-hypervall

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.

hyper-v-3-1-turn-on-off-features

Restart your computer

hyper-v-3-2-turn-on-off-features-restart-582x420

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.

vagrant-1-install-executable-696x370

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

vagrant-1-1-install-warning

Then “Run it anyway”

vagrant-1-2-install-anyway

That should open an installation wizard as shown below. Simply follow the “Next” steps as you make configurations depending on what you want

vagrant-2-start-next

Accept terms in the License Agreement and click “Next

vagrant-2-1-accept-terms-next

You can choose to install Vagrant in a different location here if it suits your requirements.

vagrant-2-2-next

Click “Install” to begin the installation process.

vagrant-2-3-Install
vagrant-2-4-Install-progress

After everything is done installing, the wizard should end as shown below. Simply click “Finish” to complete this phase of work.

vagrant-2-5-Finish

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
adding-vagrant-box-1-660x420

That will get us a Standard Ubuntu 18.04 LTS 64-bit box

Confirm later with the command below

vagrant box list
adding-vagrant-box-list-3

After the download is done, navigate to a folder you would wish to keep Vagrantfile and run the command below.

vagrant init hashicorp/bionic64
adding-vagrant-box-init-2-1-768x263

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

adding-vagrant-up-4

Our Virtual Machine should now be seen in Hyper-V Manager as shown below

confirm-vm-in-hypervmanager-768x315

Conclusion

We have successfully enabled Hyper-V, installed Vagrant and launched our Virtual Machine. We thank you for visiting and following through the guide.

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.