Vagrant repackaging box from existing one #vagrant 1

Vagrant repackaging box from existing one #vagrant

  • Vagrant repackaging box from existing one #vagrant

Vagrant repackaging is a hacky way to create a new vagrant box from an existing one, which is already configured and well tested. In this article, scope is not to explain the benefits of using virtualization in your development workflows. As well, I’m assuming that you:

  1. already have the latest vagrant installed, hostupdater plugin and virtualbox  .
  2. already have a box already up (I used scotch box from, configured to your dev needs (i.e. a proper vagrant file,  services like apache, mysql etc).

Also assuming that your colleagues have:

  1. Installed virtualbox, vagrant and hostupdater plugin
  2. Have a … Instant messenger and … a torrent client????

In my case, I like to work with a team and ask peoples’ opinion around me about the current state of dev progress or collaborate with my colleagues in LAN or WAN :D . I also like the torrent way of (thinking and) distributing large files like the one we’re about to create.

So, in this tutorial we will learn to repackage an existing vagrant box into another, new, box. Distribute the .box file, share it with all our colleagues, via torrent protocol, with the help of an open bittorrent tracker, privately, in no time! Well … not one bittorrent tracker. Actually, some more of them …

My virtual machine’s settings

As a mentioned earlier, I used scotch box from The purpose of this vm is for web development so the shared folders, apache, php5 and mysql are configured to my needs which are:

My folder structure:

Apache 2.4 with:

  1. Server Location set to /var/www
  2. Allow override all option to honour .htaccess

Mysql server:

  1. with the user accounts created and their permissions set.

Proper vagrant file with:

  1. neworking set (port forwards, static address(es), bridged interafaces etc)
  2. hostname too (to relief from web app’s URL issues)
  3. synced folder set

a minimal file like that one:


Cleaning your box

We are going to clean up your messy virtual machine! Like your sysadmin-mom!


We need to make our box as small as possible.


Repackage existing vagrant box into an other new box


Once the vagrant is done with the packaging, we’re going to create the private torrent , put three or more trackers to distribute the .box file to our team.

Distribution : Creating private torrent


Transmission is the default torrent client comes with Ubuntu and other GNU/Linux distros, mine is Ubuntu Gnome 15.10. Using transmission we’ll create the private torrent file and send it via some IM (Jabber/XMPP, skype etc) to our fellow devs.

  1. Open transmission
  2. File -> New …
  3. Select the save destination of the .torrent file
  4. Select the .box file you want to share
  5. Put trackers announce addresses (make sure there are enough of them, MPAA and the judges think that torrents are made for the pirating movies)
  6. Write some sort of a comment about the file, I prefer to use project’s name here too.
  7. Mark torrent as private (sometimes we need some privacy :P)


Now send the file to anyone who need it. If you prefer, create a small seedbox (seedboxing-like-a-boss guide is here) for two months for free (at digital ocean. no! Seriously… Do the math by yourselves!) to speed-up seeding. We are geeks, right?

Adding the .box to colleagues host machine …





Update the new Vagrantfile and change the static ip address or use an entirely different configuration for your team mate.



Thereafter run


More resources you may need:



This site uses Akismet to reduce spam. Learn how your comment data is processed.