Skip to content

Ubuntu with Vagrant and VirtualBox on Windows

In this post I show how you can use VirtualBox and Vagrant to create and launch an Ubuntu 14.04 virtual machine on Windows 8.1 host.



We will use Chocolatey to install all the required software. If you do not have it, you can install it by following the instructions on You may also see this post for instructions on how to set the Chocolatey cache location.


In order to use VirtualBox on Windows 10 you first need to disable Hyper-V.

Install VirtualBox

In PowerShell as Administrator:

choco install virtualbox

IMPORTANT: After the installation, run Oracle VM VirtualBox once and when prompted, follow the instructions to install the Oracle VM VirtualBox Extension Pack. The version of the installed extension pack should match the version of Oracle VM VirtualBox.

Add VirtualBox To System Path

Vagrant will need access to VBoxManage.exe. For that you need to add C:\Program Files\Oracle\VirtualBox to your path. You can do that easily in PowerShell, by using the Environment.SetEnvironmentVariable .NET method.

[Environment]::SetEnvironmentVariable("Path", "C:/Program Files/Oracle/VirtualBox;" + $env:Path, "Machine")

Close the PowerShell terminal and open it again, so it can pick up the PATH to VirtualBox.


We want Git for ssh.exe and other Linux tools, which are needed later by Vagrant. If you have installed ssh.exe using some other way, you may skip this step.

Install Git

In PowerShell as Administrator:

choco install git --params "/GitAndUnixToolsOnPath /NoAutoCrlf"

Now, besides git, you should have ssh, rsync, touch, clear and a number of other useful Linux tools.

Verify Git and SSH

Close and open PowerShell, so it can pick the updated PATH environment.

Verify you have git:

git --version
git version

Verify you have ssh:

usage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L address] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R address] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]


Install Vagrant

In PowerShell as Administrator:

choco install vagrant

Set VAGRANT_HOME (Optional)

The Vagrant home directory is where things such as boxes are stored, so it can actually become quite large on disk. By default, this is set to C:\Users\yourusername\.vagrant.d.

In PowerShell as Administrator:

mkdir C:/VagrantHome
[Environment]::SetEnvironmentVariable("VAGRANT_HOME", "C:/VagrantHome", "Machine")

You are now ready to launch virtual machines.

Initialize an Ubuntu 14.04 Box and Launch it

Create a directory for your project, e.g. C:\Ubuntu. Open PowerShell in the new directory and run the following commands:

vagrant init ubuntu/trusty64
vagrant up

That creates a Vagrantfile file from the ubuntu/trusty64 box. Every Vagrant development environment requires a box. You can search for boxes at

VirtualBox Guest Additions

During virtual machine boot you may get a warning about the VirtualBox Guest Additions version, something similar to this:

==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default: Guest Additions Version: 4.3.10
    default: VirtualBox Version: 5.0

There is a Vagrant plugin for that. The vagrant-vbguest plugin will check for and install the correct guest additions automatically on startup. To get the vagrant-vbguest plugin:

vagrant plugin install vagrant-vbguest

Now restart the VM:

vagrant reload

Login with SSH

vagrant ssh