how to add a local box file into vagrant box - vagrant

I'm learning vagrant( https://www.vagrantup.com/intro/getting-started/boxes.html ) ,because I can't directly "vagrant box add hashicorp/precise64" as is written on the page, first I downloaded hashicorp/precise64, then added it. It said "box:successfully added box 'hashicorp/premise64'(v0) for virtualbox". Then I configured vagrantfile as is written on the page.But when I "vagrant up",it said"Box 'hashicorp/premise64' could not be found'. ..... Process 0%......".I've been searching a solution, but can't find.Can someone help? Thanks!

Awesome to see you trying out Vagrant as it is a very useful tool. Some background on hashicorp/precise64, this box is popular yes, but is a dated version of Ubuntu 12.04. I would recommend using ubuntu/xenial64 which is Ubuntu 16.04. To use this you will first run:
vagrant init ubuntu/xenial64
then
vagrant up
This process may take some time as it is initializing the box for the first time. Once it is up and running feel free to ssh into it:
vagrant ssh
I also recommend taking a look at their quick start guide here.

Related

What is the url to the ubuntu/xenial64 box url for vagrant?

Where to find the url for the ubuntu/xenial64.box?
I only see version-info at https://app.vagrantup.com/ubuntu/boxes/xenial64. But what is the url for the box download?
I simply do:
$ vagrant init ubuntu/xenial64
$ vagrant up
But get:
The box 'ubuntu/xenial64' could not be found.
So I guess I need to put something in config.vm.box_url, but what?
If you keep clicking around and following the links on the Vagrant Cloud website, then eventually you find that the box is hosted at http://cloud-images.ubuntu.com
From there, you can find the latest version of the xenial box specifically hosted at:
http://cloud-images.ubuntu.com/xenial/current/
Direct link to Vagrant box: http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-vagrant.box
Sorry, was version mismatch. Newer vagrant works just fine.
I had Vagrant 1.4.x (on linux mint 17.1) and virtualbox 5. Online boxes were not found. Now I have Vagrant 1.8.1 (on linux mint 18.2) and virtualbox 5 and everything works as expected from the Vagrant manual (no url needed).
Thanks and sorry for waisting your time..
--
Oscar.

Download vagrant boxes via tutorial syntax

About to start tinkering with vagrant, looking at the second page of the tutorial
vagrant box add hashicorp/precise64
When I run this command however, I get
This command was not invoked properly. The help for this command is
available below.
Usage: vagrant box add [--provider provider] [-h]
I can see it takes a name before the URL, so I tried
vagrant box add ubuntu/trusty64 https://atlas.hashicorp.com/ubuntu/boxes/trusty64
but I get another error
bsdtar: Error opening archive: Unrecognized archive format
I want to download ubuntu/trusty64 specifically. What am I doing wrong?
You are using old version of Vagrant with newest documentation. You either need to update your Vagrant or read old docs.
Boxes system was revamped in 1.5 so your Vagrant is older than 1.5
I used a different site to get the boxes. The url needs to have a .box file
https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/ubuntu-14.04-amd64-vbox.box

vagrant, install chef/centos-6.6

My vagrant version is:
$ vagrant --version
Vagrant version 1.0.1
Following these instructions, vagrant init works:
$ vagrant init chef/centos-6.6
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
But vagrant up can't find the box:
$ vagrant up
There was a problem with the configuration of Vagrant. The error message(s)
are printed below:
vm:
* The box 'chef/centos-6.6' could not be found.
What is the way to configure vagrant, or the command line option, to use chef/centos-6.6?
Chef has removed all of their boxes from atlas. They have left a comment here https://atlas.hashicorp.com/chef/ saying:
If you are looking for Bento boxes they now have their own
organization https://atlas.hashicorp.com/bento/
If you trigger a:
vagrant box add chef/centos-6.6
with the outdated source (chef) it will provide feedback leading to bento as the new source, something along the lines of:
Name: bento/centos-6.6
Provider: virtualbox
Version: 2.2.0
This eventually makes more concrete what is written on the site at the chef atlas link, that the command in your question shall now instead be:
$ vagrant init bento/centos-6.6
(replacing chef by bento)
Some time ago hashicorp moved their images to atlas. Boxes are now downloaded here:
https://atlas.hashicorp.com/boxes/search
Your box is here:
https://atlas.hashicorp.com/chef/boxes/centos-6.6
I can download the box with Vagrant 1.7.2. You are using 1.0.1.
So i think it's a version issue. You have to install a newer version.

mlstate/opa vagrant box installation issue

I stumble upon the OPA framework for Javascript and decided to give it a shot.
Prefering a Vagrant Box, I did as suggested:
vagrant init mlstate/opa
vagrant up
but unfortunately it failed: Allegedly the box file is corrupted as bsdtar.exe couldn't even recognize the format while unpacking it.
What can I do, I need an official OPA Vagrant Box up and running on my Win7 machine to harness it.
I have the same problem on my Mac laptop. Installing the Vagrant Box from Vagrant Cloud does not seem to be working...
In alternative, you can try downloading the box file using the torrent on this link : http://opalang.org/Opa%20vagrant%20box.torrent
Once the box file is downloaded, issue the following commands :
vagrant box add opa-box file:///your_path_to_downloaded_file/opa.box
vagrant init opa-box
vagrant up
vagrant ssh
This works on my machine.
It's because the link leads to a redirect page to Google Drive. Bsdtar cannot open the archive because it's an HTML file. You can download it and add it using imikael21's instructions.
Here's the link it leads to: https://drive.google.com/uc?export=download&id=0B1UEOBxsn2GiN3ZpbFdMek1FNjQ
The attempted link: https://vagrantcloud.com/mlstate/opa/version/1/provider/virtualbox.box

Create/edit Vagrant base box to pre-install cookbooks

My VM takes about 10 minutes to boot because of all the cookbooks it needs to install.
I'm looking for a way to edit an existing (or create a new) base box where I can have all the required cookbooks installed. So every time I boot my VM, the cookbooks will already be installed and I won't have to wait too long.
Is this possible?
If so, could someone please point me in the right direction?
I'm currently using the Lucid32 base box.
Sounds like you need to tune your base box so install everything you need in a vagrant box and export this box as your new base box:
vagrant halt; vagrant package; vagrant box add new_basebox package.box
See here for more details on packaging, esp. the last section.
In Vagrant v2, you can use the following command to package the VM
vagrant package

Resources