Using Vagrant & VirtualBox



Rob Daniels
http://www.danielscorporation.com/slides/vagrant.html
https://github.com/rdaniels
@rdaniels61

Virtual Machine

  • A software implementation of hardware
  • Independent, Isolated
  • Host: The OS/machine running the virtualization software.
  • Guest (VM): An instance running in the virtualization software.
  • Examples:
    • VirtualBox, VMWare, Xen, KVM
    • AWS, Rackspace Cloud, Heroku, etc

Vagrant

Vagrant is free and open-source software for creating and configuring virtual development environments. It can be considered a wrapper around VirtualBox and configuration management software such as Chef, Salt and Puppet.


Source: Wikipedia

Why Use Vagrant?

 

Match Dev & Production Environment

Share Dev Setup with other Programmers

OK to Break the Server

Running Ruby on Windows

BIOS Setup

Enable Virtualization in BIOS

Software Install

GitBash: https://openhatch.org/missions/windows-setup/

Console2: http://sourceforge.net/projects/console/

VirtualBox: https://www.virtualbox.org/wiki/Downloads

Vagrant: http://downloads.vagrantup.com/

Base Box Creation

http://vagrantbox.es/   available vagrant boxes


    vagrant box add precise64 http://files.vagrantup.com/precise64.box
    vagrant init
                

VagrantFile


    VAGRANTFILE_API_VERSION = "2"

    Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
        config.vm.hostname = "my-project"
        config.vm.box = "precise64"
        config.vm.network :forwarded_port, guest: 80, host: 4567
        config.vm.network :forwarded_port, guest: 3000, host: 3000
    end
                

Vagrant Commands


    vagrant up
    vagrant ssh

    vagrant package
    vagrant box add precise64_with_rvm package.box

    vagrant box list
    vagrant box remove precise64_final
    vagrant halt
    vagrant destory --force
                

Additional Reading

Deploying Rails   ©2012 Burns & Copeland

Questions?

Thank You!



Rob Daniels
http://www.danielscorporation.com/slides/vagrant.html
https://github.com/rdaniels
@rdaniels61