Logo
  • PHP
    • HipHop / HHVM
    • Modern PHP
    • PHPStorm
    • LAMP
    • Laravel
    • Composer
    • PDO
  • JavaScript
    • node.js
    • AngularJS
  • CSS
    • SASS
    • “CSS4” (CSS level 4)
  • HTML
  • Git
  • LAMP
  • Vagrant
  • UI / UX
  • Architecture of …
  • Off-Topic
With ♥ from Berlin
November 4, 2013
Chris
Linux, Local Development, Vagrant, Virtual Machine / VM
6

How to copy Vagrant boxes (or duplicate them)

PreviousNext
vagrant

Copy vagrant box & compress it

Making a real 1:1 copy of a Vagrant box is really easy ! Simply turn off the box (if she is currently running – yes, for me a Vagrant box is female!) with

vagrant halt

and create a package.box file (default name) in the same folder with

vagrant package

That’s it. The package.box contains the full virtual machine, compressed. You can put this file whereever you want now.

 

Create a new VM from the new box file (quick method)

Now create a new folder somewhere (for your new project that uses the box) and initialize a new default Vagrantfile via

vagrant init

Open the file, and edit this: Rename the default boxname (which might be precise64) to something new, like “my-zend-framework-box“.

config.vm.box = "my-zend-framework-box"

Uncomment and edit the default box location from

# config.vm.box_url = "http://domain.com/path/to/above.box"

to the filepath of your package.box. Windows users need to write the path this way:

config.vm.box_url = "file:///d:/folder/package.box"

Then uncomment and change the default IP to something you want, I recommend increasing the last number of the IP.

config.vm.network :private_network, ip: "192.168.33.101"

Run your Vagrant box with:

vagrant up

 

Create a new VM from the new box file (long method)

If you want to add the box to your vagrant box list (to use the box by it’s name, not by giving the file location) do it like this:

vagrant package

Add the box to Virtualbox (chose a box name for name-of-this-box):

vagrant box add name-of-this-box package.box virtualbox

Now you can create virtual machines from this box by simply giving the name of the box in the Vagrantfile, like

config.vm.box = "name-of-my-box"

A config.vm.box_url is not necessary anymore.

 

Be aware of synced folder issues !

There’s a weird issue going on with the synced folder: When packing a box and creating a new virtual machine from it, you might loose the content of the synced folder in the guest system. Obviously the fresh and empty synced folder on the host deletes the synced folder’s content in the guest. I haven’t tried yet, but maybe turning off the synced folder before packing is a solution.

 

This article was written quite a while ago (10 years), please keep this in mind when using the information written here. Links, code and commands might be outdated or broken.

Random articles

  • How to setup a (or multiple) server/LAMP-stack inside a virtual machine for local development with Vagrant and PuPHPetHow to setup a (or multiple) server/LAMP-stack inside a virtual machine for local development with Vagrant and PuPHPet
  • A list of downloadable Vagrant boxes (CentOS 5.9 / 6.4, Ubuntu 12 / 13, Debian 6 / 7 / 7.1 / 7.2)A list of downloadable Vagrant boxes (CentOS 5.9 / 6.4, Ubuntu 12 / 13, Debian 6 / 7 / 7.1 / 7.2)
  • A super-simple Vagrant LAMP stack bootstrap (installable with one command)A super-simple Vagrant LAMP stack bootstrap (installable with one command)
  • A super-simple pre-configured Vagrant box with HipHop, Hack and Hack code examplesA super-simple pre-configured Vagrant box with HipHop, Hack and Hack code examples
  • [Link] How to set up HipHop, Nginx and Laravel in Ubuntu 12.04 LTS (in a Vagrant box)[Link] How to set up HipHop, Nginx and Laravel in Ubuntu 12.04 LTS (in a Vagrant box)
  • Generate Vagrant boxes with Laravel, HipHop, Nginx, WordPress, MySQL, MariaDB, MongoDB, RabbitMQ etc. with one clickGenerate Vagrant boxes with Laravel, HipHop, Nginx, WordPress, MySQL, MariaDB, MongoDB, RabbitMQ etc. with one click
  • (Links) How to fix an extremely slow Symfony inside a Vagrant box(Links) How to fix an extremely slow Symfony inside a Vagrant box
  • A preinstalled Vagrant box with PHP HipHop / HHVM and Ubuntu 12.04 (Precise Pangolin)A preinstalled Vagrant box with PHP HipHop / HHVM and Ubuntu 12.04 (Precise Pangolin)
  • A preinstalled Vagrant box with PHP HipHop / HHVM and Ubuntu 13.10 (Saucy Salamander)A preinstalled Vagrant box with PHP HipHop / HHVM and Ubuntu 13.10 (Saucy Salamander)
vagrantvirtual machinevm
Share this

6 Comments

  • Ian Douglas
    May 7, 2015 5:34 pm

    I tried following these instructions. I have a DEV folder with many sites (/www) underneath it and wanted to create a BACKUP folder and clone these sites, to remain backups and untouched. But I’m either not understanding it well or doing something wrong. First, vagrant package seems to have just captured the vagrant box, and not my sites. Second, while it seems to boot up in the end, it’s very slow and there are a number of reports that start “default: Warning: Connection timeout. Retrying… / default: Warning: Remote connection disconnect. Retrying… /” Any advice much appreciated.

    Reply
  • Alex
    October 4, 2014 1:39 am

    I had to use –name

    vagrant box add –name xirrus-xms /home/[USER]/vm/[box-file]
    .box

    Reply
  • Dário
    June 11, 2014 5:54 pm

    If you use the long method then instead of “config.vm.box=”name-of-box” you may use: vagrant init name-of-box

    Reply
  • rsschouwenaar
    April 8, 2014 10:28 am

    Awesome! Thanks for this guide!

    Reply
  • sankalp singha
    March 10, 2014 5:00 am

    Thank you so much for this information!! :)

    Reply

Leave A Comment Cancel reply

How to hack time (KUNG FURY promo campaign)

:) Finally, KUNG FURY is out! No need for further words, unless you lived in a cave for the last

php

Test out PHP 5.6alpha1 on Windows 7 / 8 with two clicks

The popular Apache-MySQLP-PHP stack EasyPHP has become very professional, maintained and especially modularized in the last 2 years, and when

php

[Link] How to create, read, update and delete (CRUD) with PDO, MySQLi and MySQL the right way (prepared statements)

Mike Dalisay has written an excellent tutorial on the CORRECT USAGE of basic CRUD functions (create, read, update, delete) with

js javascript

How JavaScript really works – An introduction into the JavaScript call stack by Philip Roberts (20min video)

This article was written quite a while ago (9 years), please keep this in mind when using the information written

php-legacy-code

Interesting talk on modernizing a legacy PHP codebase

Bringing oldschool PHP applications into 2014 is a big thing, especially when your app is valueable for your client. Paul

O’Reilly’s Learning JavaScript Design Patterns by Addy Osmani for free

Addy Osmani has published his excellent book Learning JavaScript Design Patterns for free! You can read the entire book including

JavaScript ECMAScript6 – A short video introduction (5min)

Excellent introduction into the new ECMAScript6, the spec behind JavaScript. This article was written quite a while ago (8 years),

bash-command-line-tutorial

Best introduction to unix command line / bash ever (by André Augusto Costa Santos)

This article was written quite a while ago (9 years), please keep this in mind when using the information written

logo-internet-explorer

How to professionally test on old Internet Explorer versions

If you have (or want) to test your websites and applications on older versions of Internet Explorer, then there’s a

hiphop php

HipHop VM reaches 100% green Unit Tests in Laravel, Drupal, Slim, CodeIgniter etc.

In September 2013 the PHP HipHop VM dev team wrote a very interesting article [1] about failing Unit Tests of

1/4

Categories

Search

increase-your-pagespeed-score
Increase your PageSpeed score (10min video with Matt Gaunt)
(Links) How to fix an extremely slow Symfony inside a Vagrant box
shadow dom
A quick video introduction into Shadow-DOM, the game-changing DOM-subtree-technology
php
How to install/setup latest version of PHP 5.5 on Debian Wheezy 7.0/7.1/7.2 (and how to fix the GPG key error)
hiphop php
HipHop VM reaches 100% green Unit Tests in Laravel, Drupal, Slim, CodeIgniter etc.
the-php-login-project
How to install php-login-minimal on Ubuntu 12.04 LTS
This is an experimental advertisement
Google I/O 2014 – HTTPS Everywhere (video)
phpstorm-8
A PHPStorm shortcuts cheat sheet (for Windows, Mac OS and Linux)
redaktionelle-hochlastseiten
Hochlastseiten mit PHP, MySQL und Apache am Beispiel stern.de (deutscher Artikel)
modern-php
Creator of Slim framework and “PHP – The right way” writes book: “Modern PHP”, available 2015
[Link] Redesigning SoundCloud by Evan Simoni
symfony-framework-logo
SensioLabs, creator of Symfony and Silex PHP frameworks, gets $7 million capital
php
12 tools for better PHP quality
Soundcloud’s “VP of Engineering” about using SSDs

Tags

apache bash centos composer conference coupon CSS debian fonts framework git GitHub hack HHVM HipHop HTML HTML5 IDE JavaScript JS LAMP laravel linux mod_rewrite MVC MySQL Nginx optimization PHP PHP 5.5 PHP 5.6 phpmyadmin PHPStorm security server SSD Ubuntu UI UX vagrant video virtual machine voucher VPS wordpress
Side-Project: Wordle-Solver:
www.wordle-helper.info

Pages

  • Privacy Policy
 
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT