Download vagrant box file locally from atlas and c

2019-01-20 22:07发布

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?

7条回答
The star\"
2楼-- · 2019-01-20 22:12

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.

查看更多
何必那么认真
3楼-- · 2019-01-20 22:19

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

查看更多
小情绪 Triste *
4楼-- · 2019-01-20 22:24

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.

查看更多
老娘就宠你
5楼-- · 2019-01-20 22:27

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)
查看更多
叼着烟拽天下
6楼-- · 2019-01-20 22:30

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.

查看更多
Root(大扎)
7楼-- · 2019-01-20 22:33

First: download latest version from this link Here
Update: to get download vagrant box try to use command on your terminal/CMD Like
vagrant box add laravel/homestead
you will see the download link, after that you can cancel it and copy it to download it else where using IDM/wget etc.
Second: Use this command

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


I hope this help for more information
Laravel
support

查看更多
登录 后发表回答