How to Install Vagrant with VMware on Windows

Published on Thursday, 28 June 2018

How to use Vagrant with VMware on Windows

First thing you need to be aware of with this setup is its not free. You have to not only pay for VMware Workstation, you also have to pay for the Vagrant plugin. There is apparently some instance of VMware Player being used but I doubt it is supported or that you get all the features.

You can buy a license for the plugin from here.

VMware Installation

First thing you need to do is go and aquire a license for VMware Workstation and install it.

You can get VMware Workstation Pro from here.

If you already have a license you can use chocolatey to install it via:

choco install vmwareworkstation -yes

Before you continue to the next steps open VMware Workstation and make sure its activated with your serial number. A trial version will not work.

Vagrant VMware Utility

Next step is to install the Vagrant VMware Utility package. This is required for everything to work, it basically installs a background service that manages vmware for vagrant.

You can either install it by downloading it from here or running the following chocolatey command:

choco install vagrant-vmware-utility -yes

Installing Vagrant

Now to install vagrant itself. You can do this by downloading the installer from here or running the following chocolatey command:

choco install vagrant -yes

Close and reopen any powershell windows you have open at this point.

Note: By default vagrant will download large files and store configuration in a folder called .vagrant.d in your user profile. If you want to move this to another location you can do so with the VAGRANT_HOME environment variable.

Install VMware plugin

From a fresh powershell window run the following command to download and install the VMware plugin.

vagrant plugin install vagrant-vmware-desktop

This will download and install the plugin. Next you need to activate it with the licesnse file Hashicorp will have emailed you when you purchased the license above. Change directory to the same folder as the license file in Powershell and run the following command:

Note: The direction of the slash. It needs to be / not \.

vagrant plugin license vagrant-vmware-desktop ./license.lic

At this point you will want to make sure its all installed and working with the following command:

vagrant plugin list

If everything is working you should see something like this:

vagrant-vmware-desktop (1.0.3)

Set default Provider

Last step is to set the VAGRANT_DEFAULT_PROVIDER to vmware_desktop. Doing this will cause vagrant to use VMware as its default provider. If you don't you might have vagrant try and download virtual box which is not what you want.

Testing Vagrant works

In a blank directory that you want to create your VM in run the following commands:

vagrant init hashicorp/precise
vagrant up
vagrant ssh

You should now have an SSH session into a virtual machine. To clean up use the following command:

vagrant destroy