Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vagrant package new box (from standard one)

Tags:

vagrant

I've got a standard Vagrant precise64 box. I want to add a number of packages, say git and subversion and then repackage the box. How can I use the package command to create a new box?

I know package is a plugin in v2. This doc was remove in v2 and I'm not sure how it applies http://docs-v1.vagrantup.com/v1/docs/base_boxes.html

If I try in my directory containing the vagrant machine and the Vagrant file I get:

$ vagrant package boxname --output test.box --vagrantfile Vagrantfile
The machine with the name 'boxname' was not found configured for
this Vagrant environment.

Edit: The following works

$ vagrant package --output vagrant_example.box

Which leaves me with the following questions. What is the boxname for? What does the base command do? Thanks.

like image 502
RParadox Avatar asked Sep 30 '13 12:09

RParadox


People also ask

How do I change my vagrant box?

Command: vagrant box update This command updates the box for the current Vagrant environment if there are updates available. The command can also update a specific box (outside of an active Vagrant environment), by specifying the --box flag. Note that updating the box will not update an already-running Vagrant machine.


1 Answers

I've hand crafted a couple of Vagrant base boxes (as well as using Veewee). AFAIR, the command format hasn't changed since 1.0.x.

In your case, you may have to init and up the box first, do your job and then re-package it. So the boxname (--base NAME) is the name in VirtualBox, you can get the name by using VBoxManage list vms.

vagrant package --output vagrant_example.box works because it is packaging the current vagrant box (you are in the directory where the Vagrantfile resides).

See the docs http://docs.vagrantup.com/v2/cli/package.html

--base NAME - Instead of packaging a VirtualBox machine that Vagrant manages, this will package a VirtualBox machine that VirtualBox manages. NAME should be the name or UUID of the machine from the VirtualBox GUI.

like image 106
Terry Wang Avatar answered Oct 08 '22 21:10

Terry Wang