Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy vagrant box to reuse again

I have downloaded Homestead box thrid time this month by using vagrant box add laravel/homestead. I currently do not have access to fast internet so its pretty much annoying to download it everytime. Is there a way to use the downloaded package again and include the local package in vagrant , it dosent matters if projects or synced locations are preserved or not.

I am on Ubuntu machine if that matters.

Update : I need the downloaded Homestead box so that if my machine goes down or I have to install it somewhere else with no/slow internet connectivity , I can do it locally.

like image 204
Abhinav Gauniyal Avatar asked Oct 18 '14 01:10

Abhinav Gauniyal


2 Answers

Oh that's pretty easy.

To pack up your currently installed box back into a .box file (while keeping it installed on your system) just use vagrant box list to find the box name, provider, and version.

Then use vagrant box repackage <name> <provider> <version> and it will pack it up into a file called package.box.

Hope This Helped !

like image 108
benbot Avatar answered Oct 29 '22 03:10

benbot


A better way to do it is :

  1. Just go to the directory where you have done the Vagrant init
  2. Do a vagrant package --output mynew.box

You will get the box packaged into the mynew.box file which you can even copy and share with your other developers. This is pretty useful in my opinion where you have slower internet speed.

like image 25
Sankalp Singha Avatar answered Oct 29 '22 03:10

Sankalp Singha