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:
- Install VirtualBox
- Install Vagrant(we install it using RubyGems: gem install vagrant)
Create a local Vagrant root\
mkdir vagrant && cd vagrant
Initialise the Vagrant project\
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!
Fire up the box (from the example above)\
vagrant up ubuntu_base
SSH into the box (from the example above)\
vagrant ssh ubuntu_base
Shut down the box (from the example above)\
vagrant destroy ubuntu_base
Awesome isn’t it!