有没有办法克隆一个已经安装的流浪盒子 [英] Is there any way to clone a vagrant box that is already installed

查看:20
本文介绍了有没有办法克隆一个已经安装的流浪盒子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在其他计算机上有相同的VM但我不想下载整个盒子,php mysql等...

I must have the same VM in other computers but I don't want to download the whole box, php mysql, etc...

我有一个盒子已经按照它应该的方式进行了配置,我想在其他计算机上运行这个虚拟机.

I have a box already configured the way it should be and I want to run this VM in others computers.

当用户运行vagrant up"时,机器应该在不下载任何东西的情况下启动.

When the user run "vagrant up" the machine should start without downloading nothing.

有没有人有解决方案?

推荐答案

最简单的方法是 将预先配置的 vagrant box 打包 并将 .box 文件传输到另一台机器上,添加 box 并运行 vagrant up.

The easiest thing to do would be to package the pre-configured vagrant box and transfer the .box file to the other machine, add the box and run vagrant up.

所以步骤如下:

  1. 打包预配置的框 => vagrant package --base preconfigured_vm --output/path/to/mybox.box.注意,根据文档,--base 选项应该是机器的 UUID,或者 VirtualBox 给机器的名称(在打开 VirtualBox 应用程序时找到).
  2. 使用 scprsync 或其他方法将盒子传输到计算机上...(您还可以使用 python -m http 快速启动网络服务器.server PORTruby -run -e httpd/path/to -p PORT)
  3. 初始化并启动 vagrant init preconfigured_vm/path/to/mybox.box
  4. 完成
  1. Package the pre-configured box => vagrant package --base preconfigured_vm --output /path/to/mybox.box. Note that as per the docs, the --base option should be the UUID of the machine, or the name VirtualBox gives the machine (found when opening the VirtualBox application).
  2. transfer the box to the computer by using scp, rsync or whatever... (you also start a web server quickly by using python -m http.server PORT or ruby -run -e httpd /path/to -p PORT)
  3. Init and start vagrant init preconfigured_vm /path/to/mybox.box
  4. Done

这篇关于有没有办法克隆一个已经安装的流浪盒子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆