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