I installed a VirtualBox and then installed a Ubuntu 12.10 Server Base OS in it. I have installed all kinds of php packages and other packages in it. My friends recommended me to use Vagrant so I can share my setup with my team mates easily.
Because my current VirtualBox VM was not created using vagrant up
, I am not sure how to package it. The documentation over at Vagrant talks about packaging but starts by saying:
Before working through the rest of this page, make sure the virtual environment is built by running vagrant up.
In my case, my existing VM was NOT created initially using vagrant up.
How do I package my existing VM?
Command: vagrant ssh [name|id] [-- extra_ssh_args] This will SSH into a running Vagrant machine and give you access to a shell.
The important thing to realize (and the vagrant docs are not overly clear on that) is that there are two "flavors" of packaging:
vagrant up
, which you have not. This allows you to package any customizations you have made to a vagrant base box.There's a detailed guide for creating vagrant boxes from scratch using Oracle Enterprise Linux, which might be helpful. You could also try VeeWee.
Alternatively, you could start with a Ubuntu 12.10 base box and port your customizations, in which case you could use the simpler first way of packaging.
The above refers to Vagrant 1.0. Things have changed slightly in 1.1 and in particular the docs have been rewritten:
vagrant package
command allows you to package any customizations you have made to an existing vagrant base box in the same way as in 1.0.metadata.json
file is required as Vagrant 1.1 supports multiple providers.vagrant package --output box_name.box --base "vm machine name" --vagrantfile Vagrantfile
Make sure that port forwarding and SSH keys are setup properly.
This may be a good example: https://github.com/okfn/ckan/wiki/How-to-Create-a-CentOS-Vagrant-Base-Box
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With