Vagrant Virtualized Linux development environment

Source: Internet
Author: User

Vagrant Introduction

Here directly quoted the introduction of Baidu Encyclopedia ~ ^_^
Vagrant is a ruby-based tool for creating and deploying virtualized development environments. It uses Oracle's Open source VirtualBox virtualization system to create automated virtual environments using chef. Vagrant Introduction
Vagrant because of the virtualization API that relies on VirtualBox. So before using to install VirtualBox, of course, it can also be Vwmar, here use VirtualBox

Installation steps
  1. Install VirtualBox VirtualBox please download it on VirtualBox website and install it directly after downloading.
  2. Install vagrant vagrant Please download the vagrant website (by the wall, download please go to the Vagrant download page), after downloading, follow the prompts to install. After installation, you will be prompted to restart, restart your PC
  3. To prepare the box file There are many box files here, the box file is a virtual machine file that has been initially set up and placed in a directory after downloading
  4. Adding box vagrant To add the box file is very simple, execute the following command
    Vagrant box Add mylinuxenv d:/centos5. 6. Box
    Execute this command to add a box named Mylinuxenv. Vagrant box Add supports downloading box from a remote address, but it is very slow and the general box file is very large. It is recommended to download to local, and then execute add
  5. Initialize the virtual machine if you need to use a local d:/vagrantenv/directory as the directory for the virtual machine, then CD to the directory, and then execute the following command
    Vagrant Init mylinuxenv

    You can virtualize a virtual machine with the Mylinuxenv box, which is the directory D:/vagrantenv/ . The files and directories in this directory will be automatically attached to your virtual machine, and the directory name is/vagrant/
    After the above command, the d:/vagrantenv/generates a vagrantfile that records the configuration information of some virtual machines, which directories are mounted, and so on.

  6. Communication between the virtual machine and the host in order for the host and virtual machines to be able to exchange visits, you need to add a network card for the virtual machine. Modify the Vagrantfile to remove the publicnetwork annotation.
    Execute the following command to start the virtual machine
    Vagrant up

    After execution, the virtual machine starts, but with SSH 127.0.0.1 2222 link to your virtual machine (vagrant in this machine will map 22 port to 2222 Port) to perform ifconfig-a look at the network card condition, the effect, then you can access your virtual machine through the corresponding IP

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.