I'm setting up a development environment with Vagrant. In provisioning a base box, how would I edit Vagrantfile so that Vagrant knows to get the .box file from my host?

I've followed the instructions from Sitepoint on how to configure the Vagrantfile so that Vagrant has the instructions it needs to provision the base box. But my base box file is located on my computer!

I assume it's also possible to instruct Vagrant to load the base box file from my computer instead of a url (Vagrant Cloud or DropBox) The line of code in question is below.

It specifies the name of the hosted base box file hosted on Vagran Cloud:

config.vm.box = "primalskill/ubuntu-trusty64"

You can set these properties in your Vagrantfile to specify a URL:

config.vm.box = "centos7"
config.vm.box_url = "http://myserver.mydom.om/centos7"

If it's a local file to your system where' you running vagrant:

config.vm.box = "centos7"
config.vm.box_url = "file:///tmp/centos7"

If you're on Windows:

config.vm.box = "centos7"
config.vm.box_url = "file:///C:/tmp/centos7"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.