No config.yaml file when installing Vagrant box - vagrant

So I downloaded this box: https://atlas.hashicorp.com/ncaro/boxes/php7-debian8-apache-nginx-mysql
I then go to my project folder and I execute the following commands:
vagrant init ncaro/php7-debian8-apache-nginx-mysql; vagrant up --provider virtualbox
But I dont see config.yaml in my directory. Why is that?
Best Regards

Related

Vagrant unable to provision from a machine despite copy/pasting the path

I'm having trouble starting Vagrant with Virtual box. The code I enter into a blank project folder on the command line is:
vagrant init tsawler/wafs; vagrant up --provider virtualbox
In response I get the following message:
C:\Users\Owner\PhpstormProjects\modernphptut>vagrant init tsawler/wafs; vagrant up --provider virtualbox
An invalid option was specified. The help for this command
is available below.
Usage: vagrant init [options] [name [url]]
Options:
--box-version VERSION Version of the box to add
-f, --force Overwrite existing Vagrantfile
-m, --minimal Create minimal Vagrantfile (no help comments)
--output FILE Output path for the box. '-' for stdout
-h, --help Print this help
I am copying the command line text exactly as shown on this page: https://atlas.hashicorp.com/tsawler/boxes/wafs
This is my first attempt using Vagrant/virtual machines. Anyone know why it's not working? I installed Vagrant and Virtualbox just today on my Windows 10 machine so I have the most recent versions.
This is a multiple line command and this
vagrant init tsawler/wafs; vagrant up --provider virtualbox
works well in linux or mac os but does not work for windows.
For windows you should run as
vagrant init tsawler/wafs & vagrant up --provider virtualbox
Or you can also run the commands one by one
C:\Users\Owner\PhpstormProjects\modernphptut>vagrant init tsawler/wafs
.....
C:\Users\Owner\PhpstormProjects\modernphptut>vagrant up --provider virtualbox

Vagrant : synchronised folder that is creating during provisionning error

I am trying to share a folder betwing my vagrant box and my host using this directive in Vagrantfile :
config.vm.synced_folder "./syncWithBox", "/var/www/html/"
The issue is that the /var/www/html/ folder is created during provisionning (installing apache2 server).
So when I vagrant up, there is an error because the /var/www folder does not exist before provisionning !
Is there a way to solve that ? How can I tell vagrant to perform folder sync after provionning ?
I saw a similar question here, but the answer is not exactly what I am looking for
This workaround works for me. I put the following command in an install.sh script and run it:
#!/bin/bash
vagrant plugin install vagrant-vbguest && vagrant up --no-provision
sed -i 's/#config.vm.synced_folder/config.vm.synced_folder/' Vagrantfile
vagrant halt && vagrant up --no-provision
vagrant provision
Install vbox addition with vagrant-vbguest plugin and Vagrant up the box without provisioning it
uncomment the synchronized folder directive using sed for example
stop the box and Vagrant it up without provisioning it : so the folders between host and guest are empty but synchronized
finally, provision the box

Vagrant Up not working

I have issues running vagrant up command on windows 7,I have followed all the steps mentioned in this link
When I run the command vagrant up --provider=hashicorp/precise32, in command prompt,I get the following error.
The provider 'hashicorp/precise32' could not be found, but was
requested to back the machine 'default'. Please use a provider that
exists.
I have also disabled the Antivirus before installation, but that did not help.
Vagrant works with some Providers, as VirtualBox, Xen, VMWare, AWS, Digital Ocean and Docker.
The hashicorp/precise32 is a box. After Vagrant 1.5 the Vagrant Cloud is available.
For use Vagrant, following the steps:
Install Vagrant
Install a provider, as VirtualBox
Create a new folder, as project
Open folder project
Execute vagrant init hashicorp/precise32
Execute vagrant up --provider=virtualbox or just vagrant up

How do I package a vagrantfile so that it is used when 'vagrant init' is called on the box?

I know this is a stupid question, I'm still struggling to grok vagrant.
I run vagrant on a windows host, and I'm building Linux guest VMs using VirtualBox. My guest VM is running, and now I want to package it.
The Vagrant documentation says "A common misconception is that the --vagrantfile option will package a Vagrantfile that is used when vagrant init is used with this box. This is not the case. Instead, a Vagrantfile is loaded and read as part of the Vagrant load process when the box is used. For more information, read about the Vagrantfile load order."
Got it. But that's what I want to do! When I run "vagrant package --output myboxname.box", my carefully-crafted Vagrant file does not appear to be in the package. I test the box as follows (in Windows, after copying the new box):
cd \some_new_dir
vagrant box add myboxname.box --name boxname
vagrant init boxname
The new Vagrantfile is the generic vagrant version, with none of my changes.
When I
vagrant up
The vm comes up fine, but (not surprisingly) none of Vagrantfile directives have happened.
I know I'm missing something basic -- can someone please help me out?
Try copying the Vagrantfile from the directory you ran vagrant package in to the \some_new_dir directory. Then, without running vagrant init (because this will overwrite the Vagrantfile with an empty file), run vagrant up to use the Vagrantfile.

Distributing vagrant VM locally

I have set up a vagrant vm on my machine. (Virtualbox)
I would like to be able to share this VM amongst other machines however would like to avoid having to download the image repeatedly.
I tried Exporting the Appliance and copying the Vagrantfile folder onto a different machine, however when i tried to connect using vagrant ssh it could not find it. I assume this is because of non-matching UUID's. How can I go around this?
Vagrant version 1.6.3
The solution was to use Vagrant Package
vagrant package --base <Name Of VM on virtualbox>
This creates a package.box file in your current directory.
You then share that package.box file, and on the new computers you execute:
vagrant init package.box
in the directory where the Vagrantfile will be created

Resources