I've set up a Virtualbox Ubuntu and installed Vagrant on it with
apt-get install vagrant
, nothing else.
According to this: https://laravel.com/docs/5.8/homestead I've tried:
vagrant box add laravel/homestead
after this did not work I've used:
git clone https://github.com/laravel/homestead.git ~/Homestead
and
bash init.sh
This seemed to work fine.
So I went into the folder where my code (and a Vagrant file) is and just tried
vagrant box add
(because I don't find a .box file or something like this... do I need one??)
Now I get the error:
Message: LoadError: cannot load such file -- /media/sf_contractManager/project1/backend/vendor/laravel/homestead/scripts/homestead.rb
What am I doing wrong here?
As I understand Vagrant I should get a complete environment/vm out of the Vagrant box or? No need to install php, mysql, etc. inside the Vagrant box (or outside on Virtualbox level).
Is this correct?
How can I bring the Vagrant box up?
So I went into the folder where my code (and a vagrant file) is and just tryed
vagrant box add
(because I don't find a .box file or something like this... do I need one??)
You don't need to do this, because you've already added a box on the previous step. Box is being handled on the Vagrant/VirtualBox level, not the your project level/Laravel level.
Hierarchy:
VirtualBox
|-Vagrant
|-Vagrant box (environment for your project)
| |-your project
| |-another project
|-another Vagrant box
|-another project
To bring things up, you have to go to the folder where your Homestead.yaml
is located and run vagrant up
.
Remember to run init.sh
before vagrant up
.
No need to install php, mysql, etc. inside the vagrant box (or outside on virtualbox level). Is this correct?
You are right. But you have to specify all the "tools" you'll need to use with your project. For example, certain PHP/MySQL version.
For example, the fresh way to install (tested by myself on 18.04):
apt-get
or using an archive or something else). How to install from .deb
file. Just my opinion: get a source archive and isntall manually. This way you can control the version of the software you're installing. And you'll have some experience as well.cd ~
(go to Home directory)vagrant box add laravel/homestead
git clone https://github.com/laravel/homestead.git ~/Homestead
cd ~/Homestead
git checkout release
bash init.sh
or ./init.sh
. Make sure that bash script executable. Or usesudo chmod +x init.sh
to make it executable.
Homestead.yaml
with providers you need.vagrant up
(while being in Homestead directory)./etc/hosts
file with 192.168.10.10 mywebiste.local
or so. You can find IP in the homestead.yaml
.You can find more info in the docs.