Friday, June 15, 2018

Moving a VirtualBox vagrant machine from one PC to Another.

This document outlines steps for moving a single VirtualBox based Vagrant VM from one PC to another.

1) Use the virtualbox manager to export the vagrant machine you are looking at moving.

2) Copy the exported OVF file to the other PC.

3) Tar your vagrant machine's folder:

$ tar -czvf ./VagrantMachine.tar.gz ./VagrantMachine

4) Copy this file to the new PC and to its final destination.

5) Import the OVF file into the VirtualBox manager on the new PC.

6) Extract the tar gzip'ed achive:

$ tar -xzvf ./VagrantMachine.tar.gz

7) Open the new PC's VirtualBox.xml file and find the UUID for the newly imported VM:

$ less ~/.config/VirtualBox/VirtualBox.xml

    <MachineRegistry>
      <MachineEntry uuid="{6ba80e35-75b9-4356-a575-eafc26199534}" src="/home/user/VirtualBox VMs/drupal8_default_1528979867528_60017/sdrupal8_default_1528979867528_60017.vbox"/>
      <MachineEntry uuid="{2a77b436-41c8-47e0-b4e6-1a2ebca0fb83}" src="/home/user/VirtualBox VMs/drupal7_default_1529028747318_87440/sdrupal7_default_1529028747318_87440.vbox"/>
      <MachineEntry uuid="{88bcf6b5-480c-4d37-bc2a-aa48b0e422d0}" src="/home/user/VirtualBox VMs/newVM_default_1527647210758_42083/electorhood_default_1527647210758_42083.vbox"/>
    </MachineRegistry>


8) Replace the UUID in the vagrant machine's ID file:

$ vim ./VagrantMachine/.vagrant/machines/default/virtualbox/id

9) Start the vagrant machine.

No comments:

Post a Comment