Keep Apache2 configuration and MySQL data in Vagrant package

182 views Asked by At

I currently have a Vagrant box running on Windows 10 and Virtual Box. I have multiple sites enabled in Apache 2 and Mysql databases within the box. While I keep reding that "vagrant package" will compress the whole box except Shared Folders, I can't find a way to retreive the virtual host configuration and MySQL data on another PC.

I want to copy the whole vagrant environnement to another PC.

Maybe I have a misconception about "vagrant package" command

Steps completed :

(ON ORIGINAL WIN10 PC)

  • 1) vagrant halt
  • 2) vagrant package --output package-20131222.box
  • 3) zip c:\vagrant (containing Vagrantfile and /www/ folder) to vagrant.zip
  • 4) Move package-20131222.box and vagrant.zip to new PC

(ON NEW WIN10 PC)

  • 1) Extract vagrant.zip to c:\vagrant
  • 2) Move package-20131222.box and vagrant box add ubuntu/trusty64 package-20131222.box
  • 3) vagrant up

When I SSH to the box, I cannot find my config files in /etc/apache2/sites-enabled neither can I see phpMyAdmin or my MySQL databases.

Where did I go wrong ?

Thankss !

1

There are 1 answers

2
Frederic Henri On

ubuntu/trusty64 is an existing box you should assign your new box a unique name and make sure to use this name in your new Vagrantfile.

The following steps on the new windows machine will work

  1. copy package-20131222.box and run vagrant box add mynewbox package-20131222.box

  2. copy only your Vagrantfile from the old box and change the config.vm.box = "mynewbox" (copy any other folder that you need to share with the VM)

  3. vagrant up

The new VM created will contain all content from the previous VM running on the old windows