Install Vagrant/Veewee
Vagrant is used to create/manage machine images using VirtualBox (and soon, other VMs as well). Veewee is a vagrant plugin used to define and create the base boxes that Vagrant loads into VirtualBox. Both are Ruby Gems that will be installed using a Gemfile
and bundler
. We will use these again lter to install various Chef related utilities.
Create a Gemfile
First, we need to create a Gemfile in the project directory. This file tells Ruby what gems we need to install for this project and also what versions we’ve used successfully.
In your favorite editor, create and open Gemfile
add the following lines to it and save.
1 source :rubygems
2
3 gem 'vagrant'
4 gem 'veewee'
From the top: Line 1 tells ruby (specifically
bundler
) where to try and download gems from, in this case “rubygems.org”. Lines 3-4 tellbundler
to install thevagrant
andveewee
gems.
Install Required Gems
Next, to install the gems we need, run bundle install
:
1 $ bundle install
2 Fetching gem metadata from http://rubygems.org/......
3 Installing Platform (0.4.0) WARNING: Platform-0.4.0 has an invalid nil value for @cert_chain
4
5 Installing archive-tar-minitar (0.5.2)
6 Installing builder (3.0.0)
7 Installing ffi (1.0.11) with native extensions
8 Installing childprocess (0.3.5)
9 Installing diff-lcs (1.1.3)
10 Installing json (1.5.4) with native extensions
11 Installing gherkin (2.11.2) with native extensions
12 Installing cucumber (1.2.1)
13 Installing erubis (2.7.0)
14 Installing highline (1.6.14)
15 Installing i18n (0.6.1)
16 Installing log4r (1.1.10)
17 Installing net-ssh (2.2.2)
18 Installing net-scp (1.0.4)
19 Installing open4 (1.3.0)
20 Installing popen4 (0.1.2)
21 Installing progressbar (0.11.0)
22 Installing rspec-core (2.11.1)
23 Installing rspec-expectations (2.11.2)
24 Installing rspec-mocks (2.11.2)
25 Installing rspec (2.11.0)
26 Installing thor (0.14.6)
27 Installing vagrant (1.0.5)
28 Installing virtualbox (0.9.2)
29 Installing veewee (0.2.3)
30 Using bundler (1.1.5)
31 Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
After running bundle install
, you should now have one new file in your project directory:
1 $ git status
2 # On branch master
3 # Untracked files:
4 # (use "git add <file>..." to include in what will be committed)
5 #
6 # Gemfile
7 # Gemfile.lock
8 nothing added to commit but untracked files present (use "git add" to track)
Gemfile.lock
now contains the versions of the gems that were installed. When another person bundles bundle install
on their machine, they will have the same versions installed.
1 cat Gemfile.lock
2 GEM
3 remote: http://rubygems.org/
4 specs:
5 Platform (0.4.0)
6 archive-tar-minitar (0.5.2)
7 builder (3.1.3)
8 childprocess (0.3.5)
9 ffi (~> 1.0, >= 1.0.6)
10 cucumber (1.2.1)
11 builder (>= 2.1.2)
12 diff-lcs (>= 1.1.3)
13 gherkin (~> 2.11.0)
14 json (>= 1.4.6)
15 diff-lcs (1.1.3)
16 erubis (2.7.0)
17 ffi (1.0.11)
18 gherkin (2.11.2)
19 json (>= 1.4.6)
20 highline (1.6.15)
21 i18n (0.6.1)
22 json (1.5.4)
23 log4r (1.1.10)
24 net-scp (1.0.4)
25 net-ssh (>= 1.99.1)
26 net-ssh (2.2.2)
27 open4 (1.3.0)
28 popen4 (0.1.2)
29 Platform (>= 0.4.0)
30 open4 (>= 0.4.0)
31 progressbar (0.11.0)
32 rspec (2.11.0)
33 rspec-core (~> 2.11.0)
34 rspec-expectations (~> 2.11.0)
35 rspec-mocks (~> 2.11.0)
36 rspec-core (2.11.1)
37 rspec-expectations (2.11.3)
38 diff-lcs (~> 1.1.3)
39 rspec-mocks (2.11.3)
40 thor (0.14.6)
41 vagrant (1.0.5)
42 archive-tar-minitar (= 0.5.2)
43 childprocess (~> 0.3.1)
44 erubis (~> 2.7.0)
45 i18n (~> 0.6.0)
46 json (~> 1.5.1)
47 log4r (~> 1.1.9)
48 net-scp (~> 1.0.4)
49 net-ssh (~> 2.2.2)
50 veewee (0.2.3)
51 cucumber (>= 1.0.0)
52 highline (~> 1.6.1)
53 net-ssh (>= 2.1.0)
54 popen4 (~> 0.1.2)
55 progressbar
56 rspec (~> 2.5)
57 thor (~> 0.14.6)
58 vagrant (>= 0.9.0)
59 virtualbox (>= 0.9.2)
60 virtualbox (0.9.2)
61 ffi (~> 1.0.9)
62
63 PLATFORMS
64 ruby
65
66 DEPENDENCIES
67 vagrant
68 veewee
Commit Our Work
Let get into the habit and commit our work to the git repository:
1 $ git add .
2 $ git commit -m "Installed vagrant/veewee"
3 [master 67dd65f] Installed vagrant/veewee
4 2 files changed, 71 insertions(+)
5 create mode 100644 Gemfile
6 create mode 100644 Gemfile.lock
To Continue…
- Introduction – Introduction
- Installing Prerequisites – XCode, CommandLineTools, Homebrew, RVM, Ruby, and VirtualBox
- Project Setup – Create the git repository and directory structure for Vagrant, Chef, etc.
- Vagrant/Veewee Installation – Install Vagrant/Vewee to create/control VirtualBox machines
- Define/Create a Vagrant Box – Define and Create a Vagrant Box for use i VirtualBox
- Provisioning Machines with Vagrant – Provision a cluster (Web/DB) of machines using Vagrant
- Configuring Machines Using Chef Solo – Configuring our new machine instances using Chef Solo
- Customizing Recipes for Our Application – Customize the recipes we have to prepare for our application deployment
- Create and Deploy a Rails Applications – Create a simple Rails application and deploy it to our Vagrant instances
- Migrate from Chef Solo to Hosted Chef – Migrate from using Chef Solo to hosted Chef at OpsCode
- Migrate Servers to RackCloud – Migrate your servers from VirtualBox to “The Cloud” using Rackspace.