I'm trying to install multiple of the same homestead box. Each one for a different project, totally isolated from each other. None of them will be run concurrently, only one at a time.
But when I try to run vagrant up, it tells me that a box with the name 'homestead-7' already exists. How can I rename it?
I don't see the name anywhere in the vagrantfile in the project directory, nor any 'boxes' folder in either the project .vagrant directory or my home .vagrant directory. vagrant global-status tells me that there is 1 homestead-7 box already for the project that is already in progress.
You need to add "name" property under your "Homestead.yaml" file, for example:
name: my-new-homestead
and make sure that your authorize, keys and folders are pointing to the correct path.
To use Homestead in a per project basis, you need to add it as a dependency in each one of your projects:
composer require laravel/homestead --dev
Use php vendor/bin/homestead make to generate the Vagrantfile and Homestead.yaml files. Then you can simply run vagrant up from your project.
See more on the Laravel documentation.
Related
I currently have multiple dev sites that each use Vagrant and scotchbox. Each site directory has its own copy of scotchbox, but since they're all the same I'd like to have just one scotchbox VM that I can start with any Vagrantfile, where each Vagrantfile would just change the config.vm.synced_folder.
So, for example, let's say I have:
~/Sites/cheese/
~/Sites/bacon/
~/Sites/eggs/
and then
~/Sites/sctoch-box
I'd like to be able to startup and shutdown Vagrant from ~/Sites/cheese/ or ~/Sites/bacon/ and so on without each also having their own copy of scotch-box.
Is that possible?
Yes you could potentially do that - I've not tested and don't think its official supported
but you can create the first VM from your Vagrantfile within the ~/Sites/cheese/ project, once you have created the VM, copy the Vagrant file and .vagrant directory from ~/Sites/cheese/ into ~/Sites/bacon/ and ~/Sites/egges/ so all will point to the same VM. Edit your Vagrantfile within each of your project to change the Vagrantfile if needed.
You will be able to start the VM from any of this project, but as its single VM, if you try to run vagrant from another project directory, it will not work.
I was using a computer with an already configured Vagrant/VirtualBox ambient. Now, I need to put this box in another computer.
So, I do the vagrant package and added the box in my new computer.
So when I go vagrant up and vagrant ssh everything looks perfect, and all my files are there.
But when I try to access my localhost, vagrant just show me "It Works" page.
I guess I'm missing some reference or link to my project or something like that.
I'm using Ubuntu in both computers and my project use FuelPhp.
You have some options here.
First Option
Use a synced folder in your Vagrantfile
e.g
config.vm.synced_folder ".", "/var/www"
This will change your share folder mount in /vagrant/educarebr to /var/www and Apache will see the folder.
Second Option
Create a symbolic link in vagrant using a provisioner, as Shell Script.
Third Option
Create a new virtual host in your Apache with DocumentRoot /vagrant/educarebr.
However, check your old Vagrantfile and compare with your new Vagrantfile that you are using with box created with vagrant package.
I just trying to add Vagrant to my workflow and I have following probably noob problem. I pull standard hashicorp standard 14.04 image, vagrant up it, SSH to it install my python requirements on it and then then try to execute build commands against code in Vagrant shared folder and run in to problems. Basic errors I get say those locations don't exist or cannot be found.
First action I, go ls /vagrant and can see my shared folders. I cannot cd to them from Vagrant machine I have tried to halt the machine.
Vagrantfile shared folder code.
{"virtualbox":{"/vagrant":{"guestpath":"/vagrant","hostpath":"/Users/Kimmo/Documents/Mist.io","disabled":false}}}
I am using Virtualbox as provider newest version.
My dev machine is OSX 10.9.5
There are not access limitations on the folder itself.
Thanks for you help in advance :)
Does /vagrant exists inside the VM just after you start it ?
If no you can add this parameter : "create":true. According to the doc, for the create: true paramater : If true, the host path will be created if it does not exist. Defaults to false.
If the folder /vagrant exists but you can cd or ls it, you can add parameters wich will define the right/owner of this folder:
owner: (string) the user who should be the owner of this synced folder. By default this will be the SSH user. Some synced folder types don't support modifying the owner.
group: (string) the group that will own the synced folder. By default this will be the SSH user. Some synced folder types don't support modifying the group.
Also for the hostpath parameter you have to give him a folder path, not a file path. In your conf I can see: "hostpath":"/Users/Kimmo/Documents/Mist.io". If Mist.io is a file and you want to access this file inside your VM, just give the path to the folder containing this file, /Users/Kimmo/Documents in your case.
I'm working on getting a Vagrant setup running for the first time on a Windows 8.1 machine. I've been pouring over all the documentation to understand how it all works. I used puphpet to help me configure a Ubuntu 14 LAMP development box to use.
My confusion is around how the synced folders are setup. It seems that the synced folders on install, always create a new 'default' and 'html' folder in whatever local directory I specify in my puphpet setup. I then have to put any code files I want to run in the default folder.
For example: host folder: ./www ends up having /www/default and www//html in it after Vagrant up. Why is this occurring? I left the remote folder to the default /var/www.
My ideal setup was to have a Vagrant box folder setup on my machine, and then have my code project reside in the same directory as the Vagrant box files. However, it seems that I can only put the code project in the 'default' directory that Vagrant creates.
I can't find any mention of this in the documentation. Is this normal behaviour for this to be happening? If not, how can I get around this so that I can keep the code in whatever directory that I want?
Here's the relevant code from the puphpet config file:
synced_folder:
Rh7fCuil7xE4:
source: ./www
target: /var/www
sync_type: default
rsync:
args: '-z'
exclude: .vagrant/
auto: 'false'
Author of puphpet here.
Nginx creates a folder for its default vhost (same with Apache). That's what those two folders are. It also appears there's a small bug in puphpet that will create both folders, even though one is the right one. I'll see about fixing it, but it shouldn't affect your VM in the slightest.
/var/www is what you've defined as your target, so anything that appears in your master's ./www will also appear in your VM's /var/www and vice-versa.
I had a dev setup the vagrant box and he uploaded the file which I now have on my local machine. But I am not sure how to use it as I never used vagrant before. Can someone help with the docs or directions.
thanks
Full documentation for Vagrant can be found on the website. From a practical point of view, a Vagrant box is just a provisioned VirtualBox VM.
If someone else gave you the box, they can show you how to log into it as well. After that, get coding!
Having the box file is one of the steps to have a proper development environment configured. You also need to have the configuration file vagrantfile.
Vagrant is meant to run with one Vagrantfile per project. For example; if your project path is located at C:\vagrant\project01\, inside that folder you need to put the vagrantfile related to that box. Remember this file should contain the configuration for the box that you previously downloaded.
In the case that you don’t have this file but want to use the box to adapt it to you needs you can also can configure Vagrant for that. You just need to go to the cmd, and cd (got to directory) folder of the project, in this case C:\vagrant\project01\. In the cmd windows type vagrant init and Vagrant will generate a vagrantfile for this project. In that file you can modify the config.vm.box_url parameter to point to your current box. This address could be a URI or the path to the box in your host machine for example “c:\virtualmachines\devel\machineboxname.box”.
Vagrant is so powerful that we have done no more than skim the surface of these topics.
If you just want to re-package a .box file that you were given, then you can try "vagrant box add " where the address is a URL or a physical address. Once that box is added, you can call "vagrant init" to generate your Vagrantfile and "vagrant up" to make a virtual machine based on your friend's base box. The folder that you're currently in then becomes the place where you do all future vagrant commands for this virtual machine.