我已经安装了Virtualbox Ubuntu,并使用
在其上安装了Vagrantapt-get install vagrant
,没什么。
据此:https://laravel.com/docs/5.8/homestead我已经尝试过:
vagrant box add laravel/homestead
在此操作无效后,我使用了:
git clone https://github.com/laravel/homestead.git ~/Homestead
和
bash init.sh
这似乎很好用。
所以我进入了我的代码(和Vagrant文件)所在的文件夹,并尝试了
vagrant box add
(因为我找不到.box文件或类似的东西...我需要一个吗?)
现在我得到了错误:
消息:LoadError:无法加载此类文件- /media/sf_contractManager/project1/backend/vendor/laravel/homestead/scripts/homestead.rb
我在做什么错了?
据我了解流浪者,我应该从流浪者框中获得完整的环境/虚拟机,还是?无需在Vagrant框内(或在Virtualbox级别上)安装php,mysql等。
它是否正确?
如何调出“无业游民”盒子?
答案 0 :(得分:2)
所以我进入了我的代码所在的文件夹(和 流浪文件),然后尝试
vagrant box add
(因为我找不到.box文件或类似的文件...我需要 一个??
您不需要这样做,因为您已经在上一步中添加了一个框。 Box是在Vagrant / VirtualBox级别而不是您的项目级别/ Laravel级别处理的。
层次结构:
VirtualBox
|-Vagrant
|-Vagrant box (environment for your project)
| |-your project
| |-another project
|-another Vagrant box
|-another project
要显示内容,您必须转到Homestead.yaml
所在的文件夹并运行vagrant up
。
记住要在init.sh
之前运行vagrant up
。
无需在无业游民框内(或外部)安装php,mysql等 在virtualbox级别)。这是正确的吗?
You are right。但是,您必须指定在项目中需要使用的所有“工具”。例如,某些PHP / MySQL版本。
例如,全新的安装方式(由我本人在18.04上测试):
apt-get
或使用归档文件或其他方式)安装Vagrant和VirtualBox。 How to install from .deb
file。我的看法是:手动获取源存档和isntall。这样,您可以控制所安装软件的版本。而且您还将拥有一些经验。cd ~
(转到主目录)vagrant box add laravel/homestead
git clone https://github.com/laravel/homestead.git ~/Homestead
cd ~/Homestead
git checkout release
bash init.sh
或./init.sh
。确保bash脚本可执行。或使用sudo chmod +x init.sh
使其可执行。
Homestead.yaml
with providers you need。vagrant up
(位于Homestead目录中)。/etc/hosts
来编辑192.168.10.10 mywebiste.local
文件。您可以在homestead.yaml
中找到IP。您可以在docs中找到更多信息。