怎样把 VMWare 里安装的 CentOS 打包成.box 供 vagrant 使用???

2016-05-05 17:11:32 +08:00
 abc123ccc

怎样把 VMWare 里安装的 CentOS 打包成.box 供 vagrant 使用??

因为 VMware 太吃资源了。没有 vagrant 跑得舒服。知道的请说要详细些。

谢谢。

3084 次点击
所在节点    VirtualBox
2 条回复
zqhong
2016-05-05 19:12:09 +08:00
请看这个:
https://www.vagrantup.com/docs/vmware/boxes.html

大致步骤就是,把 machine 导出,然后打包。

====

手上没有 Vmware ,用 VirtualBox 尝试了下。
Step1: 导出
VBoxManage.exe export "homestead-7" -o output\homestead.ovf

Step2: 创建 metadata.json (根据自己的需要修改,这个就是 box 文件的描述。如果你是 vmware ,请修改为: vmware_fusion 或者 vmware_workstation 。这个不大确定):
{
"provider": "virtualbox"
}


Step3: 打包
cd output
tar czvf virtualbox.box *

Step4: 添加到 vagrant
$ vagrant box add --name "test_box" --provider "virtualbox" virtualbox.box

Step5: 查看是否成功
$ vagrant.exe box list
laravel/homestead (virtualbox, 0)
test_box (virtualbox, 0)


====

vmware 如何导出,请看下面这个:
https://pubs.vmware.com/workstation-9/index.jsp?topic=%2Fcom.vmware.ws.using.doc%2FGUID-D1FEBF81-D0AA-469B-87C3-D8E8C45E4ED9.html

====

关于 box :
Box files are compressed using tar, tar.gz, or zip. The contents of the archive can be anything, and is specific to each provider. Vagrant core itself only unpacks the boxes for use later.

验证了下:
$ file homestead.box
homestead_2016_05_03.box: gzip compressed data, last modified: Tue May 3 03:36:41 2016, from Unix

====

Good luck~
ixinshang
2016-05-05 19:39:57 +08:00
每次变更了网卡物理地址 就不知道怎么处理了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/276568

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX