Getting started with Vagrant

Here are at Cloud 66 we absolutely love Vagrant. Whats not to like about the absolute simplicity and power that Vagrant brings! For those that aren’t already familiar with Vagrant, it is a command line wrapper for Oracle’s VirtualBox.

What is great about it is that it grants the power to fire up and destroy VirtualBox virtual machines with simple commands. This means we can easily use this for our local development and of course testing testing testing!

To get started:

  1. Install VirtualBox
  2. Install Vagrant(we install it using RubyGems: gem install vagrant)
  3. Create a local Vagrant root\

    mkdir vagrant && cd vagrant
    
  4. Initialise the Vagrant project\

    vagrant init
    
  5. Setup your newly created “Vagrantfile” file.You can think of it as your vagrant VM manifest and can add as many box definitions as you like with the ruby syntax below:\

    config.vm.define :ubuntu_base do |b|
        b.vm.box_url = 'http://files.vagrantup.com/precise64.box'
        b.vm.box = "ubuntu_base"
        b.vm.network :hostonly, "192.168.50.2"
    end
    

    Also, you may be wondering where to find additional source VMs for Vagrant? Well, you need wonder no longer thanks to VagrantBoxes.es!

  6. Fire up the box (from the example above)\

    vagrant up ubuntu_base
    
  7. SSH into the box (from the example above)\

    vagrant ssh ubuntu_base
    
  8. Shut down the box (from the example above)\

    vagrant destroy ubuntu_base
    

Awesome isn’t it!

Try Cloud 66 for Free, No credit card required