The Host

I run my development environment in a virtual machine, with GitNetBeans and Chrome on a host computer. For the virtual machine I am using VirtualBox together with Vagrant.

As host I have used a MacBook Pro from 2010 with 4 GB of ram running OS X Yosemite and also a Lenovo Yoga 500 with 4GB of ram running Windows 10.  On the Lenovo you need to enable virtualisation in the bios.

Ok, ready to go. One time only, I prepare the host by installing Git, Netbeans, Chrome, VirtualBox and Vagrant. On OS X I run the following in Terminal, on Windows 10 I use GitBash.

For Vagrant I add a plugin

vagrant plugin install vagrant-hostsupdater

which ensures that /etc/hosts is synchronized with the vm. On Windows 10 you need to set the permissions for %SystemRoot%\system32\drivers\etc\hosts to allow modifications.

After the required software is installed on the host you won’t need to change it anymore.

Every time I need a new vm I do the procedure explained below. When I don’t want to edit configuration files and do commands by hand, I use my Github instructions.

I create a working directory for the vm, the name is not important, e.g. mkdir ~/ts64-0816 and step into this directory.

cd~/ts64-0816

I prepare the vm with

vagrant init bento/xenial64

This creates a Vagrantfile in the directory. I add a few options and the results looks like this Vagrantfile, where I have also remove the comments. If you prefer a desktop version change the option config.vm.box as shown below, but beware that your pc requires more power to give a good experience when using the desktop.

config.vm.box = “box-cutter/ubuntu1604-desktop”

The synced_folder option is convenient when you need access to your files on the host. In my vm this maps my files to ~/host.

config.vm.synced_folder “~”, “/home/vagrant/host”

The vm needs to be given an IP network address matching and a local domain name ubuntu.dev, this is done with

config.vm.network :private_network, ip: “192.168.33.11”
 config.vm.hostname = “ubuntu.dev”

I create the vm and power it up. The very first time I do this it will take a few minutes to download a box image. When I do it again later it will go much faster.

vagrant up

I establish an ssh to the vm:

vagrant ssh

And now I am ready to install ubunty

Leave a Reply

Your email address will not be published. Required fields are marked *