V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Changelog
abc123ccc
V2EX  ›  VirtualBox

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

  •  
  •   abc123ccc · 2016-05-05 17:11:32 +08:00 · 3035 次点击
    这是一个创建于 2875 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

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

    谢谢。

    2 条回复    2016-05-05 19:39:57 +08:00
    zqhong
        1
    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
        2
    ixinshang  
       2016-05-05 19:39:57 +08:00 via Android
    每次变更了网卡物理地址 就不知道怎么处理了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3993 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 10:22 · PVG 18:22 · LAX 03:22 · JFK 06:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.