创建vagrant项目的第一步应该是新建Vagrantfile文件. 在Vagrantfile中应该明确两个问题:
1 明确项目的root文件夹位置. vagrant的很多配置选项都是根据root文件夹的位置设置的.
2 描述项目需要的机器和资源, 包括要预先安装的软件以及如何访问.
Vagrantfile文件
具体来说, 应该首先应该创建一个保存vagrant项目文件的文件夹, 并运行vagrant init进行初始化, 就会在该文件夹下自动生成一个Vagrantfile文件.
mkdir vagrant_getting_started
cd vagrant_getting_started
vagrant init
拿xnat-vagrant文件夹中的Vagrantfile为例:
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
config.vm.box = "base"
# Disable automatic box update checking. If you disable this, then