61

I want to download a vagrant box file from Atlas for using it later locally with my vagrant file. How can I do this, and how can I configure it?

rivermont
  • 223
  • 2
  • 12
Muhammad Raihan Muhaimin
  • 5,559
  • 7
  • 47
  • 68

8 Answers8

127

To download a file you have to add version and provider in the URL. For example for downloading trusty64 First you need its URL which is https://app.vagrantup.com/ubuntu/boxes/trusty64/

then you have to add version and provider afterwards, for our example the download URL would be.

https://app.vagrantup.com/ubuntu/boxes/trusty64/versions/20180206.0.0/providers/virtualbox.box

Then you have to add it locally from your vagrant file.

To add it locally to vagrant file use the following command

vagrant box add foo-box /path/to/vagrant-box.box
vagrant init foo-box
vagrant up

This will create the vagrantfile and you can configure the vagrant file.

Muhammad Raihan Muhaimin
  • 5,559
  • 7
  • 47
  • 68
  • 2
    This will not maintain the version number of the box locally. Online install does. It will keep showing that a new version is available, without an actual newer version being available. See below for fixing this issue. – Ram on Rails Feb 02 '16 at 17:17
28

However, this will add the box as version 0.

○ → vagrant box add ubuntu/trusty64 ~/Downloads/trusty-server-cloudimg-amd64-vagrant-disk1.box 
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'ubuntu/trusty64' (v0) for provider: 
    box: Unpacking necessary files from: file:///Users/ram/Downloads/trusty-server-cloudimg-amd64-vagrant-disk1.box
==> box: Successfully added box 'ubuntu/trusty64' (v0) for 'virtualbox'!

vagrant does not allow to specify a version number of the manually added box

○ → vagrant box add ubuntu/trusty64 ~/Downloads/trusty-server-cloudimg-amd64-vagrant-disk1.box --box-version 20151021.0.0
==> box: Box file was not detected as metadata. Adding it directly...
You specified a box version constraint with a direct box file
path. Box version constraints only work with boxes from Vagrant
Cloud or a custom box host. Please remove the version constraint
and try again.

To update the version number of the box, change the folder name '0' in ~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-trusty64/0 to the version number you downloaded. For example '20160120.0.0'

 |2.2.3| MacBook-Pro in ~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-trusty64
○ → mv 0 20160120.0.0

now you are all set to update the version next time with vagrant command too

○ → vagrant box list
ubuntu/trusty64 (virtualbox, 20160120.0.0)
Ram on Rails
  • 1,299
  • 11
  • 25
  • 2
    vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Importing base box 'bento/ubuntu-16.04'... ==> default: Matching MAC address for NAT networking... ==> default: Checking if box 'bento/ubuntu-16.04' is up to date... The box 'bento/ubuntu-16.04' is not a versioned box. The box was added directly instead of from a box catalog. Vagrant can only check the versions of boxes that were added from a catalog such as from the public Vagrant Server. – abumalick Nov 26 '16 at 14:31
  • 1
    In order to avoid the problem described in @abuhurayra's comment, a `metadata_url` file needs to be added inside the `ubuntu-VAGRANTSLASH-trusty64` directory. The content of the file must be `https://atlas.hashicorp.com/ubuntu/trusty64` in single line, without end-of-line character. – Willington Vega Jan 24 '17 at 01:43
  • @WillingtonVega can you please update the above link as it is broken – Devesh Jul 09 '19 at 07:40
  • @shankbond I think `https://app.vagrantup.com/ubuntu/boxes/trusty64` is the new version of that URL, but can't really test whether it works right now. If that works, then for other outdated URLs you can replace `atlas.hashicorp.com` with `app.vagrantup.com` and add `boxes` between the box owner `ubuntu` and the box name `trusty64` (separated by `/`). – Willington Vega Jul 10 '19 at 13:49
4

First: check latest version from this link Here
Update:you can try by go to the mentioned link above ,to get the number of latest version,then try to change the version in bellow URL
for now the latest version is:7.2.1
for virtualbox:
https://vagrantcloud.com/laravel/boxes/homestead/versions/7.2.1/providers/virtualbox.box
for hyperv:
https://vagrantcloud.com/laravel/boxes/homestead/versions/7.2.1/providers/hyperv.box
for vmware:
https://vagrantcloud.com/laravel/boxes/homestead/versions/7.2.1/providers/vmware_desktop.box
for parallels:
https://vagrantcloud.com/laravel/boxes/homestead/versions/7.2.1/providers/parallels.box

Maybe in the future the link changed so try to get download vagrant box by using command on your terminal/CMD by command

vagrant box add laravel/homestead

choose your virtualization method
then you will see the download link *ended with .box, after that you can cancel it CTRL+C and copy the download link and download it locally by using IDM/aria2c -x16 etc.
Second: Use this command

vagrant box add laravel/homestead {Path of file from your local computer}

Third:add metadata by go to
1- you create a file called metadata_url
NOTE: There is no extension for metadata_url

2- Then add this link and save the file

https://atlas.hashicorp.com/laravel/homestead

3- Copy metadata_url file to:

  • for windows go to

    %userprofile%.vagrant.d\boxes\laravel-VAGRANTSLASH-homestead

4- Then rename the folder named 0 to the version of the current homestead version = 7.2.1


I hope this help for more information
Laravel
metadata

Zaman
  • 811
  • 7
  • 15
  • 1
    the laravel/homestead box download link takes to a 404 page. here is the link that works: https://vagrantcloud.com/laravel/boxes/homestead/versions/6.3.0/providers/virtualbox.box – Aqib Ashef Aug 28 '18 at 13:09
4

I faced the same issue not being able to download from script. So manually downloaded the box and added to vagrant as below,

you can get versions you want from here - https://atlas.hashicorp.com/ubuntu/boxes/precise64

wget https://atlas.hashicorp.com/ubuntu/boxes/precise64/versions/20160818.0.0/providers/virtualbox.box

cd my_vagrant_project
vagrant box add precise64 ~/Downloads/precise-server-cloudimg-amd64-vagrant-disk1.box

vagrant init precise64
vagrant up
prayagupa
  • 30,204
  • 14
  • 155
  • 192
4

Download virtualbox.box:

https://app.vagrantup.com/laravel/boxes/homestead/versions/6.4.0/providers/virtualbox.box

You can change the version(6.4.0) of homestead box with the Current Version.

Current version: 6.4.0.

Check for the latest version here: https://app.vagrantup.com/laravel/boxes/homestead

After downloading the box, rename it to virtualbox.box

Don't forget to include the .box extension.

Add the downloaded homestead box to vagrant:

vagrant box add laravel/homestead file:///f:/virtualbox.box

Change the Drive( c: or d: or e:) or Path(c:/folder1/folder2/virtualbox.box) to the location where you have stored your downloaded homestead box.

You will get success massage like image below:

success image

Update homestead box

Navigate to vagrant directory:

c:/users/YourUserName/.vagrant.d/boxes/laravel-VAGRANTSLASH-homestead

After that, Create a file called metadata_url

NOTE: There is no extension for metadata_url

Then add the link below and save the file

https://app.vagrantup.com/laravel/homestead

Do not add a newline after link in above file.

Rename folder 0 to 6.4.0

6.4.0 is your homestead box version.

And it's Done. Hope it help.

Prateek
  • 1,229
  • 17
  • 31
1

If you have the ubuntu-VAGRANTSLASH-trusty64 folder from someone else machine you can simply copy paste the folder to

~/.vagrant.d/boxes

and use the vagrant up to start the servers. This way you do not need to add the trusty64 box manually.

Community
  • 1
  • 1
tk_
  • 16,415
  • 8
  • 80
  • 90
1

Instructions for OSX/Fusion:

wget https://vagrantcloud.com/hashicorp/boxes/precise64/versions/1.1.0/providers/vmware_fusion.box
# For some reason, the downloaded filename was set to an uuid
# mv <uuid> vmware_fusion.box
vagrant box add hashicorp/precise64 vmware_fusion.box
cd vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64
mv 0 1.1.0
echo -n "https://app.vagrantup.com/hashicorp/boxes/precise64" > metadata_url
vagrant box list
leodotcloud
  • 1,830
  • 14
  • 15
0

I try to use vagrant up and I got URL to download box file:

https://vagrantcloud.com/centos/boxes/7/versions/1801.02/providers/virtualbox.box

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Sneha Feb 22 '18 at 04:35
  • 1
    `atlas.hashicorp.com` not woking. We should use `vagrantcloud.com` – Hieu Nguyen Feb 22 '18 at 04:54