How to Install Manually Downloaded .box for Vagrant

你说的曾经没有我的故事 提交于 2019-11-27 00:18:40

问题


I manage to install Vagrant on my Ubuntu 14.04 LTS pc. How can I install vagrant box which I downloaded manually from a URL? I want to install Laravel Homestead but it will always fail because of my network connection. I want to download it from this link https://vagrantcloud.com/laravel/boxes/homestead/versions/11/providers/virtualbox.box but I don't know what to do after I downloaded the box.


回答1:


You can install downloaded box using this command

vagrant box add laravel/homestead path/to/your/box/file.box

Source: https://laracasts.com/forum/?p=1615-laravel-vagrant-homestead/0




回答2:


I am able to run this command on win7:

box add homestead file:///c:/homestead.box

Also this one is working:

box add homestead file:///c:\homestead.box



回答3:


Boxes also can be added using metadata json file, in which some additional configs can be provided, along with box name and its local path.

For example create metadata.json file and provide version (7.0.0) of importing box in it:

{
  "name": "laravel/homestead",
  "versions": [
    {
      "version": "7.0.0",
      "providers": [
        {
          "name": "virtualbox",
          "url": "file:///Users/path/to/box/virtualbox.box"
        }
      ]
    }
  ]
}

Then add box running vagrant box add command with metadata.json file path parameter:

vagrant box add laravel/homestead /path/to/metadata.json



Additional info: When version is not provided, imported box will have version 0 by default. And if there is check for minimum box version, when running vagrant up it will start to download box from internet instead of using already imported one.



来源:https://stackoverflow.com/questions/26655516/how-to-install-manually-downloaded-box-for-vagrant

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!