Updated docs for v0.3.0
|
@ -33,4 +33,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="content" class="container_12 clearfix">
|
||||
<div id="content" class="container_12 clearfix">
|
||||
<div class="grid_12 notice">
|
||||
Vagrant 0.3 has been released! <strong>Windows support</strong>, improved packaging, and much more! Read about the changes <a href="/docs/changes/changes_02x_03x.html">here</a>.
|
||||
</div>
|
||||
|
|
|
@ -21,4 +21,4 @@
|
|||
<div class="grid_9 omega guide">
|
||||
{{ content }}
|
||||
</div>
|
||||
{% include footer.html %}
|
||||
{% include footer.html %}
|
||||
|
|
|
@ -135,6 +135,15 @@ Then restart sudo using `/etc/init.d/sudo restart` (command may defer on operati
|
|||
Finally, verify that sudo works without a password, but running `exit` out of the root
|
||||
account, then `sudo which sudo`. You should get output similar to `/usr/bin/sudo`.
|
||||
|
||||
<div class="info">
|
||||
<h3>Disable <code>requiretty</code></h3>
|
||||
<p>
|
||||
Some distros automatically enabled <code>requiretty</code> within the sudo
|
||||
configuration. If so, there will be a line that looks like <code>Defaults requiretty</code>.
|
||||
Make sure this line is commented, otherwise Vagrant will fail.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
### Install VirtualBox Guest Additions
|
||||
|
||||
Now we have the permissions, lets gets shared folders and port forwarding working so we
|
||||
|
@ -198,38 +207,13 @@ If this box is meant to be private, we recommend you create your own custom
|
|||
pair of keys and set that up. Users of your box can then specify the private key
|
||||
you created by setting `config.ssh.private_key_path`.
|
||||
|
||||
<a name="mac-address"> </a>
|
||||
### Copy the MAC Address
|
||||
|
||||
When the operating system was installed, it typically sets up the basic network devices
|
||||
(eth0 and so on) automatically. This includes setting the MAC address of these devices.
|
||||
Since configuring these network devices is often very OS-specific, instead of Vagrant
|
||||
dynamically setting this at runtime, it forces VirtualBox to use a specific MAC address.
|
||||
|
||||
This requires little work on your end, but only needs to be done once per base box.
|
||||
Simply run `sudo ifconfig` or the equivalent and copy the MAC address down somewhere on
|
||||
your host machine. A screenshot of this is shown below:
|
||||
|
||||

|
||||
|
||||
This MAC Address will be used soon. Go ahead and shutdown the virtual machine before continuing.
|
||||
|
||||
### Export the Virtual Machine
|
||||
|
||||
Next, export the virtual machine with "File" then "Export Appliance." Export it to
|
||||
any folder, but make sure the filename is set to `box.ovf`, which is the Vagrant default.
|
||||
You may actually name this ovf file anything you wish, but naming it the default has
|
||||
no consequence and will make your life easier.
|
||||
|
||||
The export process can take several minutes. While that is running, you can progress
|
||||
onto the next step.
|
||||
|
||||
### Setup the Vagrantfile
|
||||
|
||||
Create a Vagrantfile within the directory which contains the exported virtual
|
||||
machine files (i.e. the directory with `box.ovf`). Then setup the contents of
|
||||
the Vagrantfile. The following is what the contents of the Vagrantfile should
|
||||
look like, well commented to explain each option:
|
||||
By default, Vagrant does not forward any ports. You probably want your base box
|
||||
to automatically forward SSH, at the very least. This next step allows you to setup
|
||||
a Vagrantfile which is packaged with your base box. Create this Vagrantfile in any
|
||||
directory. The following shows the contents of a sample Vagrantfile which just
|
||||
forwards SSH:
|
||||
|
||||
{% highlight ruby %}
|
||||
Vagrant::Config.run do |config|
|
||||
|
@ -237,55 +221,38 @@ Vagrant::Config.run do |config|
|
|||
# name of the forwarded port.
|
||||
config.ssh.forwarded_port_key = "ssh"
|
||||
config.vm.forward_port("ssh", 22, 2222)
|
||||
|
||||
# The name of your OVF file. This probably won't need to be changed
|
||||
# if you exported as box.ovf
|
||||
config.vm.box_ovf = "box.ovf"
|
||||
|
||||
# The MAC address which was copied earlier, without the colons ":"
|
||||
config.vm.base_mac = "0800279C2E42"
|
||||
end
|
||||
{% endhighlight %}
|
||||
|
||||
This Vagrantfile will be used during the packaging phase of base box creation.
|
||||
|
||||
### Package and Distribute
|
||||
|
||||
Now that you have the exported virtual machine and the necessary Vagrantfile,
|
||||
the final step is to package the contents into a "box" file and distribute it.
|
||||
The format of "box" files is nothing special: they're simply tar files. The
|
||||
biggest thing is to make sure that all the files in the archive are top-level,
|
||||
meaning that the files aren't in a subdirectory.
|
||||
Now that you have a completed virtual machine and possibly its accompanying
|
||||
Vagrantfile, the final step is to package the contents into a "box" file and
|
||||
distribute it. Packaging is done from Vagrant itself. Open a terminal and go
|
||||
to the directory where your base box's Vagrantfile is, if you made one. If you
|
||||
didn't make one, you can be in any directory.
|
||||
|
||||
<div class="info">
|
||||
<h3>Hold on, why not .gz, .bz2, or .7z ?!</h3>
|
||||
<p>
|
||||
Simple. When you export the virtual machine from VirtualBox, it is
|
||||
already compressed. Adding additional compression is slower and yields
|
||||
no smaller box size than just using tar.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
The following shows how to build the tar archive properly:
|
||||
Next, run `vagrant package`, specifying the name of the virtual machine in
|
||||
VirtualBox that you want to package:
|
||||
|
||||
{% highlight bash %}
|
||||
$ cd export_directory
|
||||
$ ls
|
||||
box.mf box.ovf drive.vmdk Vagrantfile
|
||||
$ tar -cvf package.box ./*
|
||||
$ vagrant package --base my_base_box --include Vagrantfile
|
||||
{% endhighlight %}
|
||||
|
||||
As with the export, this can take several minutes. The result is a file called
|
||||
`package.box` which can be distributed and installed by Vagrant users.
|
||||
This will take a few minutes, but the export will show you a progress bar. The
|
||||
result is a file named `package.box` within the same directory which can be
|
||||
distributed and installed by Vagrant users.
|
||||
|
||||
It would be a good idea to try and add this box to your own Vagrant installation,
|
||||
setup a test environment, and try ssh in.
|
||||
|
||||
{% highlight bash %}
|
||||
$ cd export_directory
|
||||
$ vagrant box add my_box package.box
|
||||
$ mkdir test_environment
|
||||
$ cd test_environment
|
||||
$ vagrant init
|
||||
# open up Vagrantfile and set config.vm.box to 'my_box'
|
||||
$ vagrant init my_box
|
||||
$ vagrant up
|
||||
$ vagrant ssh
|
||||
{% endhighlight %}
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
---
|
||||
layout: documentation
|
||||
title: Changes - 0.2.x to 0.3.x
|
||||
---
|
||||
# Changes from Version 0.2.x to 0.3.x
|
||||
|
||||
Vagrant `0.2.0` was a very stable release for Vagrant. No showstopping bugs were reported
|
||||
and based on the feedback in `#vagrant`, the mailing list, and twitter, people have been
|
||||
using Vagrant quite successfully.
|
||||
|
||||
This stability allowed us to focus on refinement and new features for Vagrant `0.3.x`.
|
||||
|
||||
## Microsoft Windows Support!
|
||||
|
||||
Vagrant now officially supports Windows as a host machine. Web developers stuck on
|
||||
Windows can now develop in linux environments while continuing to use RubyMine or
|
||||
any text editor you prefer on Windows.
|
||||
|
||||
**Windows support is very beta. Its known to work on Windows XP but Vista and
|
||||
Windows 7 are untested.**
|
||||
|
||||
For a quick-start guide on Windows, see our [Windows setup guide](/docs/getting-started/setup/windows.html).
|
||||
|
||||
## `vagrant` Command Changes
|
||||
|
||||
`vagrant down` is now `vagrant destroy`. A deprecation warning has been inserted
|
||||
into `0.3.0` but will be removed completely for any subsequent release.
|
||||
|
||||
Additionally, the `vagrant` commands are no longer "git style" binaries. This means
|
||||
that the `vagrant up` is no longer equivalent to `vagrant-up`. The space is now
|
||||
mandatory. This was required to improve extensibility and functionality of the
|
||||
specific commands.
|
||||
|
||||
## Improved Packaging
|
||||
|
||||
While Vagrant makes it easy to package (and repackage) environments for
|
||||
distribution, we thought it could be easier. The major annoyance in packaging
|
||||
was that the MAC address for boxes had to be extracted and packaged manually.
|
||||
|
||||
No more! You can now literally just do a `vagrant package` within a Vagrant
|
||||
environment, and it will package a fully functional environment. You can still
|
||||
include customizations and so on with the `--include` flag, and these will
|
||||
continue to work as expected.
|
||||
|
||||
## Base Box Packaging with `vagrant package`
|
||||
|
||||
Base box creators rejoice! You can now package base boxes using the `vagrant package`
|
||||
command. This also means that, along with the above change, you no longer need
|
||||
to "copy down the MAC address," since Vagrant handles this for you. An example,
|
||||
if you created a base virtual machine named "karmic" (in VirtualBox):
|
||||
|
||||
{% highlight bash %}
|
||||
$ vagrant package --base karmic
|
||||
{% endhighlight %}
|
||||
|
||||
That's all there is to it! No more manual Vagrantfile creation, no more manual
|
||||
`tar`ing, etc.
|
||||
|
||||
## Minor Changes
|
||||
|
||||
#### Specifying a Box with `vagrant init`
|
||||
|
||||
`vagrant init` now takes an optional argument to specify the base box. Previously,
|
||||
the generated Vagrantfile used "base" as the box and this always had to be edited.
|
||||
Now, if you want to use a "karmic" box, for example, just run `vagrant init karmic`.
|
||||
|
||||
#### Progress Bars
|
||||
|
||||
Importing and exporting VMs now have a nice progress bar (similar to HTTP
|
||||
box adding). You can visually see the progress of these operations, instead
|
||||
of blindly waiting for a few minutes. Its a minor change, but it has made
|
||||
using Vagrant that much more enjoyable.
|
||||
|
||||
This change was made possible to do a massive change in
|
||||
Vagrant's most important dependency: the [VirtualBox gem](http://github.com/mitchellh/virtualbox).
|
||||
The VirtualBox gem now uses the native C interface to talk with the
|
||||
VirtualBox API, rather than piggybacking on top of XML files and `VBoxManage`.
|
||||
|
||||
#### Chef Solo Role Support
|
||||
|
||||
Roles can now be used with chef solo by specifying a path to the roles
|
||||
directory with `config.chef.roles_path`. Roles can then be added to the
|
||||
chef run list just like chef server. For more details on how to configure
|
||||
roles for chef solo, read [the official documentation](http://wiki.opscode.com/display/chef/Chef+Solo#ChefSolo-Roles).
|
||||
|
||||
#### Refinement, Refinement, Refinement
|
||||
|
||||
While `0.2.x` had no showstopper bugs, it certainly had its share of odd
|
||||
behavior, edge case bugs, etc. All out-standing bugs in the [issue tracker](http://github.com/mitchellh/vagrant/issues)
|
||||
have been closed (as of this writing) and Vagrant is more stable than ever.
|
||||
|
||||
As always, if you run into any troubles, please report the issue on the
|
||||
GitHub [issue tracker](http://github.com/mitchellh/vagrant/issues).
|
|
@ -5,39 +5,43 @@ title: Documentation - Commands
|
|||
# Commands
|
||||
|
||||
The main interface to Vagrant is through the `vagrant` command line tools. `vagrant`
|
||||
is a "git-style" binary, meaning that it has various other binaries that are prefixed
|
||||
with "vagrant" but can be used with a space between them. Let's take a look if at
|
||||
all the vagrant binaries:
|
||||
has many other subcommands which are invoked through it, for example `vagrant up` and
|
||||
`vagrant package`. To learn about all the available subcommands through `vagrant`, simply
|
||||
run `vagrant` alone:
|
||||
|
||||
{% highlight bash %}
|
||||
# Hitting tab to have our shell complete the filename with available binaries
|
||||
$ vagrant
|
||||
vagrant
|
||||
vagrant-box
|
||||
vagrant-down
|
||||
vagrant-halt
|
||||
vagrant-init
|
||||
vagrant-package
|
||||
vagrant-reload
|
||||
vagrant-resume
|
||||
vagrant-ssh
|
||||
vagrant-status
|
||||
vagrant-suspend
|
||||
vagrant-up
|
||||
Usage: vagrant SUBCOMMAND ...
|
||||
|
||||
Supported commands:
|
||||
box Box commands
|
||||
destroy Destroys the vagrant environment
|
||||
halt Halts the currently running vagrant environment
|
||||
init Initializes current folder for Vagrant usage
|
||||
package Packages a vagrant environment for distribution
|
||||
reload Reload the vagrant environment
|
||||
resume Resumes a suspend vagrant environment
|
||||
ssh SSH into the currently running environment
|
||||
ssh-config outputs .ssh/config valid syntax for connecting to this environment via ssh
|
||||
status Shows the status of the current environment.
|
||||
suspend Suspends the currently running vagrant environment
|
||||
up Creates the vagrant environment
|
||||
{% endhighlight %}
|
||||
|
||||
But just like git, we can use any of these tools by using a space instead of a
|
||||
hyphen, so `vagrant init` is the same as `vagrant-init`.
|
||||
|
||||
Each binary has its own documentation associated with it as well. By running
|
||||
`vagrant help COMMAND`, the documentation will show for the given command.
|
||||
But we'll go over each binary here, as well.
|
||||
|
||||
<a name="vagrant-box"> </a>
|
||||
## vagrant box
|
||||
|
||||
Boxes have their own section: [Vagrant Boxes](/docs/boxes.html)
|
||||
|
||||
<a name="vagrant-destroy"> </a>
|
||||
## vagrant destroy
|
||||
|
||||
This destroys the vagrant environment by completely deleting the virtual machine
|
||||
along with the hard drives attached to the virtual machine. `vagrant up` can then
|
||||
be run again to rebuild the environment.
|
||||
|
||||
**Warning: This command _will_ delete all the data created within the machine.**
|
||||
|
||||
<a name="vagrant-halt"> </a>
|
||||
## vagrant halt
|
||||
|
||||
|
@ -84,6 +88,32 @@ you could use ssh directly, but using `vagrant ssh` means you don't have to reme
|
|||
or what port ssh is forwarded to from your box. To learn more about those settings see the section on the [Vagrantfile](/docs/vagrantfile.html).
|
||||
If you're box is booted simply run `vagrant ssh` from the root of your project directory.
|
||||
|
||||
<a name="vagrant-ssh-config"> </a>
|
||||
## vagrant ssh-config
|
||||
|
||||
Although Vagrant provides direct access to SSH with the created environment via `vagrant ssh`, its
|
||||
sometimes useful to be able to access the environment via a tool such as SCP or git, which requires
|
||||
an entry in `.ssh/config`. `vagrant ssh-config` outputs a valid entry for `.ssh/config` which can
|
||||
simply be appended to the file. Example output:
|
||||
|
||||
{% highlight bash %}
|
||||
$ vagrant ssh-config
|
||||
Host vagrant
|
||||
HostName localhost
|
||||
User vagrant
|
||||
Port 2222
|
||||
UserKnownHostsFile /dev/null
|
||||
StrictHostKeyChecking no
|
||||
IdentityFile /opt/local/lib/ruby/gems/1.8/gems/vagrant-0.3.0/keys/vagrant
|
||||
{% endhighlight %}
|
||||
|
||||
Then, after putting this entry into my `.ssh/config`, I could do something like the following,
|
||||
to show a single example:
|
||||
|
||||
{% highlight bash %}
|
||||
$ scp vagrant:/vagrant/my_file.txt ~/Desktop/my_file.txt
|
||||
{% endhighlight %}
|
||||
|
||||
<a name="vagrant-status"> </a>
|
||||
## vagrant status
|
||||
|
||||
|
|
|
@ -31,6 +31,21 @@ Here is a link directly to the [download page](http://www.virtualbox.org/wiki/Do
|
|||
</p>
|
||||
</div>
|
||||
|
||||
## Setting up Ruby and RubyGems
|
||||
|
||||
Although Vagrant is written in Ruby, web developers from many different languages
|
||||
come to use it (Python, Java, Clojure, etc.). Therefore, if you've never setup Ruby
|
||||
or RubyGems before, please check out our basic guides, written for different
|
||||
popular operating systems listed below:
|
||||
|
||||
* [Windows](/docs/getting-started/setup/windows.html)
|
||||
* [Mac OS X](/docs/getting-started/setup/mac.html)
|
||||
* [Ubuntu](/docs/getting-started/setup/ubuntu.html)
|
||||
|
||||
Is your OS not listed above? Feel free ask for help via our [support channels](/support.html).
|
||||
Or if you figure it out on your own, let us know how and we'll gladly update the
|
||||
website.
|
||||
|
||||
## Install Vagrant
|
||||
|
||||
Vagrant is packaged as a [RubyGem](http://rubygems.org/). Since Vagrant is written
|
||||
|
|
|
@ -8,14 +8,13 @@ This initial section will introduce the binaries and Vagrantfile, which are
|
|||
used extensively in controlling Vagrant. The remainder of the getting started
|
||||
guides assumes this basic knowledge.
|
||||
|
||||
## Vagrant Binaries
|
||||
## Vagrant Binary
|
||||
|
||||
Once Vagrant is installed, it is typically controlled through the `vagrant`
|
||||
command line interface. Vagrant comes with around 10 separate binaries, all prefixed
|
||||
with `vagrant`, such as `vagrant-up`, `vagrant-ssh`, and `vagrant-package`. These are
|
||||
known as _git style binaries_ (since they mimic git). Taking it one step further,
|
||||
the hyphen between the commands are optional. To call `vagrant-up` for example, you
|
||||
could just do `vagrant up` and the two commands would behave the exact same way.
|
||||
command line interface. The `vagrant` binary has many "subcommands" which can be
|
||||
invoked which handle all the functionality within Vagrant, such as `vagrant up`,
|
||||
`vagrant ssh`, and `vagrant package`, to name a few. To discover all the supported
|
||||
subcommands, just run `vagrant` alone, and it'll list them out for you:
|
||||
|
||||
## The Vagrantfile
|
||||
|
||||
|
|
|
@ -15,28 +15,24 @@ containing the exported virtual machine and optionally
|
|||
additional files specified on the command line. A common file also included
|
||||
with boxes is a Vagrantfile. If a Vagrantfile exists in a box, it will be
|
||||
added to the configuration load chain. Boxes can use a Vagrantfile to specify
|
||||
default forwarded ports, SSH information, etc.
|
||||
default forwarded ports, SSH information, etc. Note, however, that a Vagrantfile
|
||||
is not required to be packaged with a box, and boxes will work just fine
|
||||
without one.
|
||||
|
||||
Before working through the rest of this page, make sure the virtual environment
|
||||
is built by running `vagrant up`.
|
||||
|
||||
## Creating the Vagrantfile
|
||||
|
||||
The first step is to create a Vagrantfile which does most of the heavy
|
||||
lifting for the users of your box and to remove code which isn't useful
|
||||
for boxes. First, backup your old Vagrantfile by copying it to something like
|
||||
`Vagrantfile.bak`. Then, remove everything pertaining to provisioning, since the
|
||||
packaged box will already be fully provisioned since its an export of the
|
||||
running virtual machine. Second, remove the base box configuration, since
|
||||
there is no base box for a box. And finally, we need to add in the MAC address of the
|
||||
virtual machine so the internet access will work on any machine (more on
|
||||
this later). The resulting Vagrantfile should look like the following:
|
||||
First, we're going to create a basic Vagrantfile we'll package with the
|
||||
box which will forward the web port. This way, users of the box can simply
|
||||
add the box, do a `vagrant up`, and have everything working, including HTTP!
|
||||
First, backup your old Vagrantfile by copying it to something like
|
||||
`Vagrantfile.bak`. Then, create a new Vagrantfile which simply forwards the
|
||||
web port. The resulting Vagrantfile should look like the following:
|
||||
|
||||
{% highlight ruby %}
|
||||
Vagrant::Config.run do |config|
|
||||
# Mac address (make sure this matches _exactly_)
|
||||
config.vm.base_mac = "0800279C2E41"
|
||||
|
||||
# Forward apache
|
||||
config.vm.forward_port("web", 80, 8080)
|
||||
end
|
||||
|
@ -71,7 +67,7 @@ The second command is where the meat is. `vagrant package` takes the virtual
|
|||
environment from the current project and packages it into a `package.box`
|
||||
file in the same directory. The additional options passed to the command tell
|
||||
it to include the newly created Vagrantfile with it, so that the users of
|
||||
the box will already have the MAC address and port forwarding setup.
|
||||
the box will already have port forwarding setup.
|
||||
|
||||
## Distributing the Box
|
||||
|
||||
|
@ -83,14 +79,18 @@ keep the box on a secure filesystem where the public cannot access it.
|
|||
If the box you're distributing is meant to be public, HTTP is the best
|
||||
resource to upload to, so that anyone can easily download it.
|
||||
|
||||
Once the box is in place, other developers can add it like any other box:
|
||||
Once the box is in place, other developers can add it and use it just
|
||||
like any other box. The example below is from the point of view of a new
|
||||
developer on your team using your newly packaged box:
|
||||
|
||||
{% highlight bash %}
|
||||
$ vagrant box add my_box /path/to/the/package.box
|
||||
$ vagrant init my_box
|
||||
$ vagrant up
|
||||
{% endhighlight %}
|
||||
|
||||
After that they just have to configure their Vagrantfile to use the box as
|
||||
a base, run `vagrant up`, and they should have a fully working development
|
||||
environment! Notice that they don't have to do provisioning or any of that;
|
||||
since we already did all that, the exported virtual machine has it done
|
||||
already.
|
||||
At this point, they should have a fully functional environment which exactly
|
||||
mirrors the environment set up in previous steps of the guide. Notice that
|
||||
they didn't have to do do provisioning, or set up anything on their system
|
||||
(other than Vagrant), etc. Distributing development environments has never
|
||||
been so easy.
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
layout: getting_started
|
||||
title: Getting Started - Setting up Mac OS X
|
||||
---
|
||||
# Mac OS X
|
||||
|
||||
## Built-in
|
||||
|
||||
Mac OS X actually comes with Ruby and RubyGems built straight into the
|
||||
operating system already. These installations work with Vagrant if you
|
||||
want the "quick and easy setup." If this is the case, just head back to
|
||||
the [getting started overview page](/docs/getting-started/index.html)
|
||||
and continue with the guide!
|
||||
|
||||
## MacPorts
|
||||
|
||||
Generally, Ruby developers in general prefer to use [MacPorts](http://www.macports.org/) to install
|
||||
a more up-to-date and unmodified version of Ruby and RubyGems rather
|
||||
than relying on the stock OS X install.
|
||||
|
||||
First, install [MacPorts](http://www.macports.org/) which is a simple
|
||||
`dmg` file which is downloaded from their site. Be sure to follow their
|
||||
instructions on setting up the `PATH` variable, if necessary (the installer
|
||||
actually automatically does this on the more recent versions of MacPorts).
|
||||
|
||||
Next, install Ruby and RubyGems with a single command:
|
||||
|
||||
{% highlight bash %}
|
||||
$ sudo port install ruby rb-rubygems
|
||||
{% endhighlight %}
|
||||
|
||||
And you'll probably want to update your RubyGems installation, since
|
||||
MacPorts's is often out of date:
|
||||
|
||||
{% highlight bash %}
|
||||
$ sudo gem update --system
|
||||
{% endhighlight %}
|
||||
|
||||
And now your system is prepped and ready to go.
|
|
@ -0,0 +1,48 @@
|
|||
---
|
||||
layout: getting_started
|
||||
title: Getting Started - Setting up Ubuntu
|
||||
---
|
||||
# Ubuntu
|
||||
|
||||
## Installing Ruby
|
||||
|
||||
The easiest way to install Ruby and RubyGems is via Ubuntu's built
|
||||
in package manager:
|
||||
|
||||
{% highlight bash %}
|
||||
$ sudo aptitude install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8 libopenssl-ruby wget
|
||||
$ sudo ln -s /usr/bin/ruby1.8 /usr/bin/ruby
|
||||
$ sudo ln -s /usr/bin/ri1.8 /usr/bin/ri
|
||||
$ sudo ln -s /usr/bin/rdoc1.8 /usr/bin/rdoc
|
||||
$ sudo ln -s /usr/bin/irb1.8 /usr/bin/irb
|
||||
{% endhighlight %}
|
||||
|
||||
## Installing RubyGems
|
||||
|
||||
It is recommended that you install RubyGems from source. All the dependencies
|
||||
for RubyGems were installed above already so installing from source is
|
||||
fairly painless:
|
||||
|
||||
{% highlight bash %}
|
||||
$ cd ~
|
||||
$ wget http://rubyforge.org/frs/download.php/69365/rubygems-1.3.6.tgz
|
||||
$ tar xvzf rubygems-1.3.6.tgz
|
||||
$ cd rubygems-1.3.6
|
||||
$ sudo ruby setup.rb
|
||||
$ sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
|
||||
{% endhighlight bash %}
|
||||
|
||||
You'll also want to verify that RubyGems is fully updated, since the
|
||||
packages can often get out of date:
|
||||
|
||||
{% highlight bash %}
|
||||
$ sudo gem update --system
|
||||
{% endhighlight %}
|
||||
|
||||
## VirtualBox OSE
|
||||
|
||||
By default, VirtualBox installed via Ubuntu's package repositories
|
||||
will be "VirtualBox Open Source Edition (OSE)." Vagrant may work with
|
||||
this edition (as long as its version 3.1+), but it is not officially
|
||||
supported. It is recommended that you download the installation package
|
||||
from the [VirtualBox website](http://virtualbox.org) for the full version.
|
|
@ -0,0 +1,82 @@
|
|||
---
|
||||
layout: getting_started
|
||||
title: Getting Started - Setting up Windows
|
||||
---
|
||||
# Windows
|
||||
|
||||
<div class="info">
|
||||
<h3>Windows Support</h3>
|
||||
<p>
|
||||
Windows support is a recent addition to vagrant so if you do experience trouble
|
||||
or find this section hard to follow, please see the <a href='/support.html'>support page</a>
|
||||
and let us know so we can help you. Our goal is to make Vagrant the best tool
|
||||
for the job on as many platforms as possible.
|
||||
</p>
|
||||
<p>
|
||||
All Windows testing has been performed from the vanilla Windows XP command prompt. Cygwin support
|
||||
is planned but Vista and Windows 7 testing will have to be a community effort. If you are interested
|
||||
in testing the latest updates please checkout the <a href='http://github.com/mitchellh/vagrant'>github page</a>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
## Install Ruby and Vagrant
|
||||
|
||||
The first step is to get Ruby and RubyGems running on Windows. We recommend [RubyInstaller](http://rubyinstaller.org/) for
|
||||
a quick one-click solution, and this is the solution we support. There are, however, [other methods](http://www.ruby-lang.org/en/downloads/) to getting
|
||||
Ruby running on windows.
|
||||
|
||||
Once Ruby and RubyGems are installed, install Vagrant with a single command:
|
||||
|
||||
{% highlight bash %}
|
||||
C:\> gem install vagrant
|
||||
{% endhighlight %}
|
||||
|
||||
Finally, as with other platforms, you will need to have downloaded and installed [Oracle's Virtualbox](http://www.virtualbox.org/)
|
||||
for Vagrant to run properly. Vagrant will verify this when it is first run.
|
||||
|
||||
## Good to go!
|
||||
|
||||
With Vagrant installed, you can now follow the remainder of the [getting started guide](/docs/getting-started/index.html)
|
||||
just like any other Vagrant user and everything should work the same across all
|
||||
operating systems, including Windows.
|
||||
|
||||
The only difference is `vagrant ssh` and this is covered below:
|
||||
|
||||
#### SSH
|
||||
|
||||
Since SSH is not easy to use/install on the command line under Windows we have included
|
||||
a [Putty](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) formatted private
|
||||
key generated from the key pair included with the Vagrant gem. This allows quick and easy SSH
|
||||
access to all base boxes that leverage that key pair.
|
||||
|
||||
To configure Putty we need 3 things: a user to log on with, the port that Vagrant forwarded for ssh,
|
||||
and the location of the ppk file. By default the first two will be `vagrant` and `2222`, but there
|
||||
are many reasons those may be different, especially the port (other vm's services etc). At this point
|
||||
if you issue `vagrant ssh` from the directory where you created your initial vm you should see
|
||||
something like the following:
|
||||
|
||||

|
||||
|
||||
It's important to take note of both the port and the .ppk file location. If you've used the Ruby installer,
|
||||
the above path will be the same for you taking into account the version of the Vagrant gem you have installed.
|
||||
Moving on, once you've got Putty installed, opening putty.exe will present you with the connection
|
||||
configuration window. First enter the SSH information and a name for the connection, then open the SSH
|
||||
configuration sub-tree.
|
||||
|
||||

|
||||
|
||||
Here in the `Auth` configuration section we'll take the path information provided to us above and locate
|
||||
the .ppk file via the browse dialog.
|
||||
|
||||

|
||||
|
||||
Once you've done that head to the top of the configuration tree, click the `Session` tree item and save
|
||||
the putty configuration so it will be available for use again later.
|
||||
|
||||

|
||||
|
||||
Last but not least, click the Open button to be presented with a bash prompt inside your new and shiny
|
||||
Vagrant virtual development environtment! If you've taken the steps above to save the configuration it
|
||||
should be easy to use and adapt to other virtual environments created with Vagrant.
|
||||
|
||||
|
|
@ -23,6 +23,19 @@ Last login: Fri Mar 5 23:21:47 2010 from 10.0.2.2
|
|||
vagrant@vagrantbase:~$
|
||||
{% endhighlight %}
|
||||
|
||||
<div class="info">
|
||||
<h3>Using Microsoft Windows?</h3>
|
||||
<p>
|
||||
SSH is not easy to install or use from the Windows command-line. Instead,
|
||||
Vagrant provides you with a <code>ppk</code> file which can be used with
|
||||
<a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/">PuTTY</a> to
|
||||
connect to your virtual environments.
|
||||
</p>
|
||||
<p>
|
||||
Read more about this issue on the <a href="/docs/getting-started/setup/windows.html">Windows setup page</a>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
## Accessing the Project Files
|
||||
|
||||
Vagrant bridges your application with the virtual environment by using a
|
||||
|
|
|
@ -140,6 +140,21 @@ Vagrant::Configure.run do |config|
|
|||
end
|
||||
{% endhighlight %}
|
||||
|
||||
## Roles
|
||||
|
||||
Chef solo supports [roles](http://wiki.opscode.com/display/chef/Roles), which are specified via
|
||||
JSON files within a roles directory. Similar to the cookbooks path, a roles path can be specified
|
||||
to a directory containing these role files, and these roles can then be used by the
|
||||
chef solo run list. An example of configuring roles is shown below:
|
||||
|
||||
{% highlight ruby %}
|
||||
Vagrant::Configure.run do |config|
|
||||
# The roles path will be expanded relative to the project directory
|
||||
config.chef.roles_path = "roles"
|
||||
config.chef.add_role("web")
|
||||
end
|
||||
{% endhighlight %}
|
||||
|
||||
## Configuring the Server Path
|
||||
|
||||
In order to run chef, Vagrant has to mount the specified cookbooks directory as a
|
||||
|
@ -169,5 +184,5 @@ end
|
|||
|
||||
Once enabled, if you are building a VM from scratch, run `vagrant up` and provisioning
|
||||
will automatically occur. If you already have a running VM and don't want to rebuild
|
||||
everything from scratch, run `vagrant reload` and provisioning will automatically
|
||||
occur.
|
||||
everything from scratch, run `vagrant reload` and it will restart the VM, without completely
|
||||
destroying the environment first, allowing the import step to be skipped.
|
46
docs/rake.md
|
@ -31,35 +31,42 @@ as well.
|
|||
|
||||
## Loading the Vagrant Environment
|
||||
|
||||
The first step to doing _almost_ anything with Vagrant is to make sure the
|
||||
environment is loaded. The environment must be loaded before anything is
|
||||
done except for configuring and running methods in the `Vagrant::Command`
|
||||
class. If you need custom configuration, make sure you
|
||||
define your configuration blocks _before_ loading the environment. If you
|
||||
are going to use a Vagrant command, you can run it before or after an
|
||||
environment load with no consequence. For
|
||||
everything else, load the environment _first_.
|
||||
The first step to doing anything with Vagrant is to make sure that the
|
||||
environment is loaded. Each Vagrant project has its own "environment"
|
||||
which simply encapsulates the configuration, SSH access, VM, etc.
|
||||
of that project.
|
||||
|
||||
Loading the environment sets up all the paths, loads the virtual
|
||||
machine (if one exists), and loads the configuration. Loading the
|
||||
environment is a one-liner:
|
||||
environment for the current directory is a one-liner:
|
||||
|
||||
{% highlight ruby %}
|
||||
Vagrant::Env.load!
|
||||
env = Vagrant::Environment.load!
|
||||
{% endhighlight %}
|
||||
|
||||
If you're working in a separate directory or you're writing a script that
|
||||
will be used with multiple Vagrant projects, you can load a specific
|
||||
Vagrant environment by passing in a path:
|
||||
|
||||
{% highlight ruby %}
|
||||
env = Vagrant::Environment.load!("/path/to/my/project")
|
||||
{% endhighlight %}
|
||||
|
||||
## Executing Commands
|
||||
|
||||
All available `vagrant` command line tools are available in code through
|
||||
the `Vagrant::Commands` class as class methods. The following is a sample
|
||||
rake task that simply does the equivalent of `vagrant up`, but does some
|
||||
useless things around it:
|
||||
the `commands` accessor on the environment instance. This allows you to
|
||||
easily to run the command line tools in the context of an environment
|
||||
without any extra fuss. The following is a simple rake task that simply
|
||||
does the equivalent of `vagrant up` but does some extra, useless things
|
||||
around it:
|
||||
|
||||
{% highlight ruby %}
|
||||
# Example of emulating vagrant up with some code around it
|
||||
task :up do
|
||||
puts "About to run vagrant-up..."
|
||||
Vagrant::Commands.up
|
||||
env = Vagrant::Environment.load!
|
||||
env.commands.up
|
||||
puts "Finished running vagrant-up"
|
||||
end
|
||||
{% endhighlight %}
|
||||
|
@ -67,7 +74,8 @@ end
|
|||
## SSH Commands
|
||||
|
||||
Perhaps you want to write a rake task that does some commands within the
|
||||
virtual server setup? This can be done through `Vagrant::SSH`. `Vagrant::SSH`
|
||||
virtual server setup? This can be done through the `ssh` accessor of the
|
||||
environment, which is an instance of `Vagrant::SSH`. `Vagrant::SSH`
|
||||
is simply a wrapper around `Net::SSH` and the objects returned are typically
|
||||
`Net::SSH` objects.
|
||||
|
||||
|
@ -76,13 +84,13 @@ shutdown command:
|
|||
|
||||
{% highlight ruby %}
|
||||
task :graceful_down do
|
||||
Vagrant::Env.load!
|
||||
Vagrant::Env.require_persisted_vm
|
||||
Vagrant::SSH.execute do |ssh|
|
||||
env = Vagrant::Environment.load!
|
||||
env.require_persisted_vm
|
||||
env.ssh.execute do |ssh|
|
||||
ssh.exec!("sudo halt")
|
||||
end
|
||||
end
|
||||
{% endhighlight %}
|
||||
|
||||
This example also shows `Env.require_persisted_vm` which simply errors and
|
||||
This example also shows `env.require_persisted_vm` which simply errors and
|
||||
exits if there is no Vagrant VM created yet.
|
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 65 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 97 KiB |
2
index.md
|
@ -11,7 +11,7 @@ virtual environments. For more information, see the part of the
|
|||
getting started guide on "[Why Vagrant?](/docs/getting-started/why.html)"
|
||||
|
||||
Are you ready to revolutionize the way you work? Check out
|
||||
the [getting started guide](/docs/getting-started/index.html) and the
|
||||
the [getting started guide](/docs/getting-started/index.html), the
|
||||
[getting started video](http://vimeo.com/9976342).
|
||||
|
||||
## Your First Vagrant Virtual Environment
|
||||
|
|