Vagrant creates a cross-platform development environment

Source: Internet
Author: User

After the two projects were developed, the team environment was different, and bug fixing by integration became a tough task. Although a test server was built later, sometimes it still cannot be connected to the test Server due to network issues. Because the abilities and habits of team members are different, some use Windows and others love Ubuntu environment development. Although they can build their own virtual machines, installation of Environment tools and plug-ins may lead to environment differences. Such a problem clearly contradicts the team collaboration and does not conform to the programmer's logic. There must be a corresponding solution. This method is vagrant, and vagrant is open source.

Step 1: Install the Virtual Machine support environment: virturalbox

Click here to download javasuralbox. Different systems have different requirements. Ubuntu directly downloads the Deb package and installs it directly. Virtualbox is small and free. Replace VMware directly.

Step 2: Install vagrant

Click here to download vagrant and install it according to the installation methods of various systems. You can also directly download the Deb package under Ubuntu and install it directly.

PS: thanks to the open-source software and multi-platform (Linux/MAC/Windows) support, we can build a cross-platform development environment.

Step 3: Download vagrant box

Here is the official vagrant box images supported by vagrant. Here is the official vagrant box image provided by ubuntu.

Step 4: Add vagrant box to vagrant

Vagrant box add cjp ~ /Cjp/vagrant/trusty64.box #~ /Cjp/vagrant/trusty64.box is the vagrant box image path

Step 5: Initialize the vagrant Box Environment

Cd ~ /Cjp/vagrant # vagrant box path vagrant init cjp # initialize the vagrant environment. cjp is the name of vagrang box and added when the box is added to vagrant. See step 4.

In this case, the vagrant configuration file of vagrantfile appears in the directory. You can modify the default configuration. to specify the Virtual Machine IP address, remove the comment before the corresponding configuration command:

config.vm.network "private_network", ip: "192.168.55.123"

Step 6: Start vagrant

Vagrant up # vagrant SSH in the corresponding directory of vagrantfile # enter the virtual machine through SSH

Now, you can successfully enter the virtual machine environment and build the required development environment.

After all the environments are built, they are just a private development environment. How can we share them with other partners to achieve the same development environment? Vagrant certainly supports the following:

Vagrant package -- Base cjp/Ubuntu -- output cjp_ubuntu.box # -- Base specifies the default Virtual Machine name in vaturalbox, and -- output specifies the output file name.

If you have a small team member and need to set up a development environment, you only need to get the vagrant box file set up, and vagrant add can build the same environment.

To transfer files between the virtual machine and the local machine, the shared directory of the virtual machine is/vagrant. The shared directory of the local machine is the virtual machine vagrantfile directory.

Vagrant creates a cross-platform development environment

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.