4, Vagrantfile Common configuration

Source: Internet
Author: User

1. Vagrantfile Introduction

Vagrantfile is a simple text file that allows you to define various configurations of a virtual machine, such as network, memory, hostname, and so on, each project needs to have a vagrantfile, which can be found in the directory where Vagrant Init is executed, or it can be written manually


2. Configuration

Vagrant.configure (2)  do |config|    //vagrant starter configuration block   config.vm.box  =  "CentOS"           //define box name    config.vm.hostname =  "hostname"    //define virtual machine name   config.vm.box_url =  "C:/me/vagrant-centos-6.7.box"     //Specify base Mirror location   config.vm.synced_folder  "/ Path/to/share ", " Path/to/mount " //the first parameter is a shared directory on the host, and the second parameter is the mount directory of the vagrant virtual machine   config.vm.network   "Forwarded_port",  guest: 80, host: 80   // Map the 80 port of the vagrant virtual machine to the host's 80 port----------------------SSH-related configuration--------------------------------------------------------   config.ssh.username =  "vagrant"    //set default SSH user (default user is vagrant)    config.ssh.password =  "vagrant"    //set default SSH password (default password is vagrant)    config.ssh.port = 22              //setting up SSH ports   --------------------- Some configuration based on VirtualBox--------------------------------------------  config.vm.provider  "VirtualBox"  do |v|    v.gui = false        virtualbox gui    v.name =  "MY_VM" is not displayed when  //is started       //name displayed in VirtualBox     v.cpus = 2             //Specify the number of virtual machine cores     v.memory =  "1024x768"      //specifying virtual machine memory   endend     //vagrant end configuration block


This article is from "Mr. Peach" blog, please be sure to keep this source http://peach3412.blog.51cto.com/12037226/1850719

4, Vagrantfile Common configuration

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.