vagrant入门指南(二): 创建vagrant项目

创建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
  
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值