Vagrant Note

Vagrant Note

 

1 vagrant 命令

    vagrant init hashicorp/precise64    #需要先删除Vagrantfile文件

    vagrant up                          #启动虚拟机,  根据Vagrantfile文件启动

    vagrant destroy                     #清空修改的内容,还原box

    vagrant ssh                         #连接到虚拟机

    vagrant box remove                  #删除box

    vagrant suspend                     #休眠,会保存内存的内容到硬盘,下次up比较快,

    vagrant halt                        #关机,正常关机,可以保存修改过的内容

    vagrant box list                    #列出目前的Machine

    vagrant global-status               #列出之前缓存的配置文件路径

 

2 镜像

    vagrant box add hashicorp/precise64    #从网络中下载镜像(box)

    vagrant box add /path/to/lxc-centos6.5-2013-12-02.box   #使用本地的镜像

 

 

3 Vagrantfile内容配置

    用哪个box

    Vagrant.configure("2") do |config|

      config.vm.box = "hashicorp/precise64"  

    end

 

 

4. Trouble Shut

    1. A Vagrant environment or target machine is required to run this

command. Run `vagrant init` to create a new Vagrant environment. Or,

get an ID of a target machine from `vagrant global-status` to run

this command on. A final option is to change to a directory with a

Vagrantfile and to try again.

    如果出现这个,表示没有找到Vagrantfile文件,如果生成的Vagrantfile存在别的目录,需要先cd

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值