V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Changelog
abc123ccc

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

  •  
  •   abc123ccc · May 5, 2016 · 3833 views
    This topic created in 3647 days ago, the information mentioned may be changed or developed.

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

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

    谢谢。

    2 replies    2016-05-05 19:39:57 +08:00
    cha1
        1
    cha1  
       May 5, 2016
    请看这个:
    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  
       May 5, 2016 via Android
    每次变更了网卡物理地址 就不知道怎么处理了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2505 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 06:59 · PVG 14:59 · LAX 23:59 · JFK 02:59
    ♥ Do have faith in what you're doing.