Let’s package the box and send it to trial by Vagrant
You finished the Tutorial and want to try out your Box?
Or did you jump here in advance?
Whatever, here we go!
You already installed Vagrant, didn’t you?
Else fetch a copy from here and we may start.
First shut down your Virtual Machine, if you haven’t already.
In your Host OS, open a Command Line Window / Terminal Window
and change to the directory, where VirtualBox saved the Virtual Disk
(You can see where it did that viewing Storage).
Now type:
vagrant package --base {your-VirtualBox-machine-name}
This might take some time, so fetch yourself a coffee or something.
After Vagrant packaged your box, enter:
vagrant box add {your-VirtualBox-machine-name} package.box
This, again, takes some time. Afterwards, change to another directory,
where you want your Vagrantfile (configuration for your box) to be placed,
and initialize your box:
vagrant init {your-VirtualBox-machine-name}
After the Vagrantfile was created, open it in an editor,
uncomment the following lines and save the file:
config.vm.provider "virtualbox" do |vb| vb.gui = true end
In case you wondered, the Vagrantfile is written in Ruby,
but don’t jump there now ;). (For the eager to learn…)
Now let’s start up your Vagrant Box:
vagrant up
When everything went OK, we’re now up and running.
Had enough? Then:
GOING BERSERK
You just wanted to try your box, haven’t followed
the other parts of this tutorial (as they exist ;) and
now want to change your original VirtualBox?
Steer to the directory with your Vagrantfile from
the command line and enter:
vagrant destroy
This will terminate all running Virtual Vagrant Machines.
Next order Vagrant to remove the box:
vagrant box remove {your-Vagrant/VirtualBox-machine-name}
Now you have to start all over again, everything is down
the drain, you’ll never get it up and running again! *hrhrhr*
Just kidding. Just jump back to the part your curiosity urged
you to leave or just start experimenting – and then come back here
to package your Box again.
Hope you had fun and learned something, cause,
That’s all, folks!