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.
Related
I just started using Vagrant. Now, One of my clients shared a GIT repo with the following files & directories :
Vagrantfile (file)
Vagrant (directory)
Now, I don't understand what will be my next step ? Every resource in the internet assumes that I am creating a new box from scratch (vagrant init hashicorp/precise64). But, here I need to match the box environment that is shared with me.
Thanks.
As stated in the previous answers - download the repository, and enter (cd via command line) the directory.
Once in there - you should just be able to run vagrant up to initiate the download and configuration of the vagrant box. Your client will (in theory) have set up the Vagrantfile to configure the machine appropriately.
Note: It might be worth checking to see if they have specified a hostname for the box [i.e mynewproject.dev] (found in Vagrantfile or sometimes, in a .yaml configuration file (i.e site.yaml).
If they have - it would be worth updating your hosts file to make sure you can use the host name locally.
The Vagrantfile will described everything about the VM you will build, so it knows about the vagrant box to use, you will have something like
Vagrant.configure("2") do
....
config.box = "hashicorp/precise64"
...
end
If the box is available freely on Atlas (such as hashicorp/precise64) vagrant will download the box and spin a new VM. If the box is not freely available, you will need to install yourself with vagrant box add
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 am using Vagrant with Homestead on Windows 10 to sync my Laravel app to virtualbox.
Everything seems fine until i run laravel app in browser via custom domain like laravel.app then i get error No input file specified.
When i ssh into virtualbox i see that no files have been added from my project folder.
My homestead.yaml is most definitely configured correctly and i have entry in hosts file for custom domain.
I use all the latest versions and i did vagrant provision
I think my problem is somewhere in virtualbox but don't know where.
Here is my homestead.yaml config file http://pastebin.com/nJCqD4Qq
I'm using vagrant and have hashicorp/precise32 box. My projects in /products/ folder on this box. I want to reach this folder from my host computer. So added this configuration to my Vagrantfile
config.vm.synced_folder "/products","/products"
Also created /products folder on host. But after reload when I connect to box over SSH, /products folder's all contents are disappearing. When I comment out the config.vm.synced_folder line and reload, contents appering again.
Can you please tell me what's I missing?
Thank you.
Vagrant sync folder works the other way around
Synced folders enable Vagrant to sync a folder on the host machine to
the guest machine, allowing you to continue working on your project's
files on your host machine, but use the resources in the guest machine
to compile or run your project.
so if you have an existing folder on your guest machine and you ask vagrant to create a sync folder with one of your folder from the host, it will do but replace the content from the content of your host.
There is an old question with some good reference to understand it further
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.