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 (9 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

java vs php

Switching from Java to PHP. Seriously. A very interesting and pre-judice-free talk with Ph.D. Aris Zakinthinos

Ph.D. Aris Zakinthinos, CTO of achievers.com, a well-scalability-experienced guy and former IT employee of the military, has just delivered one

php-7

PHP 6.0 will be PHP 7

Germany’s excellent PHP Magazin just posted interesting news: The next major version of PHP will be PHP 7, the development

digitalocean coupon

Free $10 coupon for DigitalOcean SSD cloud VPS hosting

DigitalOcean puts out another coupon, this time for free $10 with the code SSD2014. The company offers small and big

windows-xp-eol

Windows XP is officially dead from today. Do you know people still using it ? Punch them.

From today, April 8th 2014, Windows XP is officially dead. Basically XP was already dead in 2009 when – after

How to show the available version of a package (before doing apt-get install)

To show the version of the package that will be installed with apt-get install, do apt-cache policy packagename. To show

js javascript

Push database changes to all clients in real-time (!) with AngularJS and Firebase

The coolest talk I’ve seen this week: Anant Narayanan of Firebase shows how to build a simple but really impressive

hack-php

Facebook releases HipHop (HHVM) 3.0, adds mysqli and support for Hack language

Lots of movement in the PHP world these days! After releasing Hack (a dramatically improved fork of the entire PHP

steam sale coupon voucher

-30% to -90% on Steam and Origin

Soft off-topic, but as most developers like to play from time to time, this might be your change to grab

Joshua Davis – my hero of Flash – in two excellent interviews (audio, video)

Joshua Davis is the reason why I’ve started to code. Seriously. Back in the late 90ies, the internet was a

This picture shows the icon of blindness

How blind people use websites (video with Sina Bahram, blind accessibility researcher)

162 million people worldwide are blind or visually impaired at a level that does not allow to read texts. An

1/4

Categories

Search

set up a local virtual machine for development with vagrant and puphpet / puppet (and ubuntu, linux, php, apache, mysql)
A super-simple pre-configured Vagrant box with HipHop, Hack and Hack code examples
Dangerous Performance Myths in the Web (video talk by Thomas Lohner, PHPUG Latvia)
vagrant
Generate Vagrant boxes with Laravel, HipHop, Nginx, WordPress, MySQL, MariaDB, MongoDB, RabbitMQ etc. with one click
php-7
PHP 6.0 will be PHP 7
php
appserver.io – A New Way of Magento Enterprise Infrastructure (26min video talk)
How to fix the ugly font rendering in Google Chrome
goodbye-lamp-going-hhvm-nosql-nginx-php
[RePost] Goodbye LAMP: Going Nginx, NoSQL, HHVM (41min conference talk with Arne Blankerts)
php
Must-read PHP blog: PHPweekly.com
Disappointed by Watch Dogs’s graphics ? See how it looks with unlocked, hidden settings. Awesome!
phpstorm-8
Ignore .idea folder from git in PHPStorm
php uk conference
Slides & talks from PHP UK Conference 2014
windows-xp-eol
Windows XP is officially dead from today. Do you know people still using it ? Punch them.
set up a local virtual machine for development with vagrant and puphpet / puppet (and ubuntu, linux, php, apache, mysql)
A list of downloadable Vagrant boxes (CentOS 5.9 / 6.4, Ubuntu 12 / 13, Debian 6 / 7 / 7.1 / 7.2)
Bézier Curves – Under the Hood (4min video)
vagrant
How to setup a (or multiple) server/LAMP-stack inside a virtual machine for local development with Vagrant and PuPHPet

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