Command list
>vagrant status
>vagrant halt
>vagrant status
>vagrant package --output centos7test.box
>vagrant box list
>vagrant box add centos7test centos7test.box
>vagrant box list
Detail
from vagrant help
e:\VM\centos01>vagrant package --help
Usage: vagrant package [options] [name|id]
Options:
--base NAME Name of a VM in virtualbox to package as a base box
--output NAME Name of the file to output
--include FILE... Additional files to package with the box
--vagrantfile FILE Vagrantfile to package with the box
-h, --help Print this help
e:\VM\centos01>
create a box file from an exisiting vm.
e:\VM\centos01>vagrant status
Current machine states:
default running (virtualbox)
The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.
e:\VM\centos01>vagrant halt
==> default: Attempting graceful shutdown of VM...
e:\VM\centos01>vagrant status
Current machine states:
default poweroff (virtualbox)
The VM is powered off. To restart the VM, simply run `vagrant up`
e:\VM\centos01>
e:\VM\centos01>vagrant package --output centos7test.box
==> default: Clearing any previously set forwarded ports...
==> default: Exporting VM...
==> default: Compressing package to: e:/VM/centos01/centos7test.box
e:\VM\centos01>
add this new box file into Vagrant.
e:\VM\centos01>vagrant box list
base (virtualbox, 0)
bento/centos-5.11 (virtualbox, 2.2.9)
centos/7 (virtualbox, 1509.01)
centos6.5 (virtualbox, 0)
centos7 (virtualbox, 0)
centos7.2 (virtualbox, 0)
mysql5.6_base (virtualbox, 0)
e:\VM\centos01>vagrant box add centos7test centos7test.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'centos7test' (v0) for provider:
box: Unpacking necessary files from: file://e:/VM/centos01/centos7test.box
box: Progress: 100% (Rate: 466M/s, Estimated time remaining: --:--:--)
==> box: Successfully added box 'centos7test' (v0) for 'virtualbox'!
e:\VM\centos01>vagrant box list
base (virtualbox, 0)
bento/centos-5.11 (virtualbox, 2.2.9)
centos/7 (virtualbox, 1509.01)
centos6.5 (virtualbox, 0)
centos7 (virtualbox, 0)
centos7.2 (virtualbox, 0)
centos7test (virtualbox, 0)
mysql5.6_base (virtualbox, 0)
e:\VM\centos01>