Lately, I am trying to learn more about Ansible and Vagrant, so first thing I need was to get all stuff installed on my computer ready. This is what I did:

1.Disable Hyper-V

To avoid unnecessary risks, following Vagrant recommendations, I preferred to temporarily disable Hyper-V if you had enabled it, and forget about the battles of the hypervisors:

PS > Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All

2.Installing Windows Subsystem for Linux (WSL)

This topic is pretty easy, only had to go to the Microsoft Store on Windows 10, and look for Ubuntu App.

If you face any issue or want to know more info about this process, have a look at this link:

3.Installing VirtualBox

Just download it from VirtualBox site and install it as usually

4.Installing Vagrant

Easier than expected this time; one code liner:

$ sudo apt install vagrant

Installing Vagrant

Verifying Vagrant installation:

$ vagrant --version

5. Finishing last settings

5.1 Environmental variables

This is absolutely necessary to avoid errors, you can add it to .bashrc if you prefers


5.2 Creating Vagrantfile

Vagrantfile has to contain one line to avoid error related to Stderr, so including here how to download first image or box example to adjust related Vagrantfile

# Add new box
$ vagrant box add ubuntu/bionic64

# Make project folder and modifying Vagranfile
$ mkdir vagrant
$ cd vagrant
$ vagrant init ubuntu/bionic64

5.3 Setting Vagrantfile

As VirtualBox installed is Windows based, it’s necessary to share a folder for using by vagrant (WSL) and VirtualBox (Windows).

In my case, I made c:\vagrant, so I moved Vagrantfile to this folder once created and modified it accordingly:

$ cp Vagrantfile /mnt/c/vagrant
$ cd /mnt/c/vagrant

Following lines were modified/added:

config.vm.synced_folder "../data", /mnt/c/vagrant"
config.vm.provider "virtualbox" do |vb|
  vb.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ]

6. Running the box

Last and not least, this line to finish all good job done

$ vagrant up


Leave a Reply

%d bloggers like this: