5.3 KiB
layout | title |
---|---|
getting_started | Windows |
Windows
Windows Support
Windows support is a recent addition to vagrant so if you do experience trouble or find this section hard to follow, please see the support page 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.
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 github page.
Assumptions
The following assumes you have installed Ruby 1.8.6 or greater (see here, in the Ruby on Windows section) with RubyGems and issued the following from a command prompt:
{% highlight bash %} C:> gem install vagrant C:> gem install win32console {% endhighlight %}
Also, as with other platforms, you will need to have downloaded, installed, and opened Oracle's Virtualbox at least once to generate the necessary configuration files for it, and vagrant, to run properly.
Post Installation
After you have completed the above there are a few more important Windows specific configuration items to handle.
Adding VBoxManage to Your Path
Vagrant, and the virtualbox gem on which it relies, require that the VBoxManage utility is present in your Windows path. When VirtualBox is installed on Windows it doesn't add the utility to the Windows path automatically so you'll need to do that yourself. By default the utility is installed into 'C:\Program Files\Sun\Virtual Box'. If you've installed VirtualBox to a different location you'll need to use that directory when adding it to the path.
You can add this or other folders to the Windows XP path by taking the following steps. First click Start, right click My Computer and select Properties. Select the Advanced tab in the window that pops up and find the Environment Variables button
In the next window locate the System Variables list and find the Path variable. Click edit.
Select the Variable value field and make your way to the end of the dialog to append the path that contains your VirtualBox install and the VBoxManage executable. Make sure to separate each path you add with a semi-colon.
You can verify that VBoxManage has been made available by opening a command prompt and testing with VBoxManage
. You should see the help listing for the tool. You can now continue with the installation of a base box and creation of your first Vagrant virtual machine.
{% highlight bash %} C:\ > vagrant box add base http://files.vagrantup.com/base.box C:\ > cd MyProjectDir C:\ MyProjectDir> vagrant init C:\ MyProjectDir> vagrant up {% endhighlight %}
After this completes you'll need to move onto the following section to connect to your VM.
Putty
Since SSH is not easy to use/install on the command line under Windows we have included a Putty 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 1.8.6 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.