Configuring the Vagrant environment under Windows

Source: Internet
Author: User
Tags putty ssh client

Vagrant is a Ruby-based tool for creating and deploying virtualized development environments. It uses Oracle's Open source VirtualBox virtualization system.

Vagrant in the rapid development environment is very good, imagine a team, everyone to develop the same thing, before everyone to build a set of development environment, with Vagrant, you only need to build a copy, and then distributed to all team members, so that everyone immediately have the exact same development environment, Even if you have a member under Windows, you can easily use the LINUX environment for development. If the team come to new people, do not need to teach him how to build a development environment, give him a box is good, as long as he mastered the use of Vagrant, immediately can be integrated into the development, without having to bother to install complex environment.

Vagrant's cross-platform features are simply fantastic, and it's all about the benefits of VirtualBox, a great software and Vagrant of talented engineers.

Vagrant also supports the use of chef and Puppet to maintain your virtual development environment, but because I am not familiar with these two tools, this article does not introduce, only briefly describes if you configure a Vagrant environment under Windows.

Installing Vagrant

After downloading the latest Vagrant and corresponding VirtualBox installation from Vagrant website, create a new folder to configure the Vagrant

Because using the Vagrant init precise32 http://files.vagrantup.com/precise32.box command to download the box will be slow, so it is best to use the Thunderbolt and other tools in advance to download the box placed in a file, Then the local path is used when initializing, which is much faster.

Vagrant Init precise32. \boxes\precise32.box

It is important to note that when using local paths, you need to use the Windows-style path, which uses \ as the path delimiter.

PS: available Vagrant Boxes see here: http://www.vagrantbox.es/

Port forwarding

Configuring port forwarding in Vagrant is convenient

Vagrant.configure ("2") do |config|  # Other Config here  config.vm.network:forwarded_port, guest:80, Host:8080end

The above configuration will establish a forwarding relationship between the 80 port in Vagrant and the 8080 port on your local computer, so that you can access http://localhost:8080 in the local computer, which is equivalent to accessing http://localhost:80 in Vagrant.

Port forwarding can configure multiple groups.

Shared folders

A very important step in using Vagrant is to share folders (thanks to the powerful VirtualBox)

Set in Vagrantfile

Config.vm.synced_folder "E:/blog", "/home/vagrant/blog"

The first parameter, E:/blog, is the folder path that needs to be shared on this computer, the second parameter is the mapping path in the Vagrant virtual machine, and note that the second parameter needs to use an absolute path, such as/home/vagrant/blog

Connect to Vagrant

Once configured, you can start the virtual machine and connect to the Vagrant.

First, execute vagrant up, wait for a moment, vagrant will start up well. ::

E:\vagrant\precise32>vagrant Reload[default] Attempting graceful shutdown of VMS ... [Default] Setting the name of the VM ... [Default] Clearing any previously set forwarded ports ... [Default] Creating Shared Folders metadata ... [Default] Clearing any previously set network interfaces ... [Default] Preparing network interfaces based on configuration ... [Default] Forwarding ports ... [Default]--2222 (adapter 1) [Default]--[Adapter 1] [default]--(Adapter 1) [Def Ault] Booting VM ... [Default] Waiting for VM to boot. This can take a few minutes. [Default] VM booted and ready for use! [Default] Configuring and enabling network Interfaces ... [Default] Mounting Shared Folders ... [Default]--/vagrant[default]--/home/vagrant/blog[default]--/home/vagrant/notes[default]--/home/vagrant/ Projects

If you vagrant up and then modify the vagrantfile to make it work, you need to execute vagrant Reload

Under Windows, you cannot use vagrant SSH to access Vagrnat directly, but this command tells you how to connect vagrant via SSH:

e:\vagrant\precise32>vagrant ssh ' ssh ' executable not found on any directories in the%PATH% variable. is ANSSH client installed? Try installing Cygwin, MinGW or Git, all of the Whichcontain an SSH client. Or Use the PuTTY SSH client with the Followingauthentication information shown Below:host:127.0.0.1port:2222username:va Grantprivate Key:c:/documents and Settings/greatghoul/.vagrant.d/insecure_private_key

This allows you to use an SSH client like putty to access the vagrant for development, and it is highly recommended that the Chrome extension secure Shell be used.

Vagrant Details : please click here
Vagrant : please click here.

How to use vagrant to install a Hadoop cluster on a virtual machine http://www.linuxidc.com/Linux/2013-04/82750.htm

Efficient Puppet module management in Vagrant http://www.linuxidc.com/Linux/2014-05/101873.htm

Use Vagrant and Fabric for integration testing http://www.linuxidc.com/Linux/2014-07/104113.htm

Use Vagrant to build a development environment http://www.linuxidc.com/Linux/2014-07/104116.htm

This article permanently updates the link address : http://www.linuxidc.com/Linux/2014-07/104115.htm

Configuring the Vagrant environment under Windows

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.