VirtualBox Windows VM to Vagrant Base Box

2019-03-15 16:53发布

问题:

I have created a Windows 8 VM in VirtualBox, and have customized settings, and installed software on it.

Now I would like to turn it into a Vagrant Base Box, so that I can share with team, and also spawn many other VMs based on my cutomized windows.

It is possible to do, I have seen Windows Base boxes in vagrantcloud. Except that there is no documentation on packaging an existing windows virtualbox VM.

Please help me with instructions, or link to instructions to create a Vagrant Base Box from my existing windows VM. creating a base box documentation does not help me, as it is for linux.

Thank you in advance SO community!

回答1:

You can probably do that by using the --base argument to vagrant package.

First, locate the name of the VM on VirtualBox's GUI. Say it's called "Windows", you issue:

vagrant package --base Windows --output /path/to/windows.box

That .box file will be your base box. You can install it locally by using

vagrant box install /path/to/windows.box

Alternatively you can make it available on a server and put its URL on the config.box_url parameter in your Vagrantfile.