Skip to content

DeveloperVirtualMachine

Kevin Brightwell edited this page Aug 26, 2015 · 1 revision

This page outlines how to setup a virtual machine using Vagrant and VirtualBox. This can be beneficial for development as it allows for a consistent environment and multiple, independent workspaces.

Note the versions used below may change.

Prereq 1: have Ruby installed. I used RVM to get Ruby 1.9.3:

rvm get stable
rvm install 1.9.3
source ~/.rvm/scripts/rvm
type rvm | head -n 1
rvm use 1.9.3 --default
  1. Get the latest version of VirtualBox
  2. Get the latest version of Vagrant
  3. Get the latest version of Packer to create a base Ubuntu box.
  4. Create a JSON template for Packer: ubuntu-13.04-template.json
{
  "builders": [
    {
      "type": "virtualbox",
      "guest_os_type": "Ubuntu_64",
      "iso_url": "http://releases.ubuntu.com/13.04/ubuntu-13.04-desktop-amd64.iso",
      "iso_checksum": "8d72e2db7e72e13813731eab37a14d26",
      "iso_checksum_type": "md5",
      "ssh_username": "packer",
      "shutdown_command": "shutdown -P now"
    }
  ],

  "provisioners": [
  ],

  "post-processors": [
    {
        "type": "vagrant"
    }
  ]
}
  1. Run 'packer build ubuntu-13.04-template.json'

  2. Shutdown the vm from VirtualBox interface

  3. Package the box with Vagrant: "vagrant package --base 'name of VM as displayed in VirtualBox'

  4. Create the following Vagrantfile: my.Vagrantfile

  5. Run the following Shell Script: install.sh:

    #!/bin/bash
    
    VM_NAME="umple-dev"
    PACKAGE="package.box"
    SOURCE_VAGRANTFILE="my.Vagrantfile"
    SINK_VAGRANTFILE="Vagrantfile"
    vagrant box add "$VM_NAME" "$PACKAGE" --force
    vagrant init "$VM_NAME"
    
    cp "$SOURCE_VAGRANTFILE" "$SINK_VAGRANTFILE"
    vagrant up
    exit 0
    
Clone this wiki locally