ODe*_*lta 3 virtualbox vagrant laravel homestead
我把笔记本电脑带出了家几天,在那段时间甚至没有打开它。回来后,准备继续摆弄我的项目,但页面突然停止工作。我开始在浏览器中收到 ERR_ADDRESS_UNREACHABLE 信息。
我已经卸载了 homestead box、vagrant、virtualbox,每次都重新启动,重新安装了所有内容,同样的问题。
我无法 ping 该192.168.10.10地址,但可以通过 SSH 连接到该盒子,没有问题。
运行 MacOS Big Sur、VirtualBox 6.1、Vagrant 2.2.18 以及最新的 homestead 版本。真的要完全放弃编程,这真是太令人沮丧了。我真的很感激任何帮助。谢谢
Homestead.yaml
---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Documents/Code
to: /home/vagrant/code
sites:
- map: homestead.test
to: /home/vagrant/code/PHP/test/public
databases:
- homestead
features:
- mysql: true
- mariadb: false
- postgresql: false
- ohmyzsh: false
- webdriver: false
services:
- enabled:
- "mysql"
Run Code Online (Sandbox Code Playgroud)
流浪文件
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'json'
require 'yaml'
VAGRANTFILE_API_VERSION ||= "2"
confDir = $confDir ||= File.expand_path(File.dirname(__FILE__))
homesteadYamlPath = confDir + "/Homestead.yaml"
homesteadJsonPath = confDir + "/Homestead.json"
afterScriptPath = confDir + "/after.sh"
customizationScriptPath = confDir + "/user-customizations.sh"
aliasesPath = confDir + "/aliases"
require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')
Vagrant.require_version '>= 2.2.4'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if File.exist? aliasesPath then
config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
config.vm.provision "handle_aliases", type: "shell" do |s|
s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases && chown vagrant:vagrant /home/vagrant/.bash_aliases"
end
end
if File.exist? homesteadYamlPath then
settings = YAML::load(File.read(homesteadYamlPath))
elsif File.exist? homesteadJsonPath then
settings = JSON::parse(File.read(homesteadJsonPath))
else
abort "Homestead settings file not found in #{confDir}"
end
Homestead.configure(config, settings)
if File.exist? afterScriptPath then
config.vm.provision "Run after.sh", type: "shell", path: afterScriptPath, privileged: false, keep_color: true
end
if File.exist? customizationScriptPath then
config.vm.provision "Run customize script", type: "shell", path: customizationScriptPath, privileged: false, keep_color: true
end
if Vagrant.has_plugin?('vagrant-hostsupdater')
config.hostsupdater.remove_on_suspend = false
config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
elsif Vagrant.has_plugin?('vagrant-hostmanager')
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.aliases = settings['sites'].map { |site| site['map'] }
elsif Vagrant.has_plugin?('vagrant-goodhosts')
config.goodhosts.aliases = settings['sites'].map { |site| site['map'] }
end
if Vagrant.has_plugin?('vagrant-notify-forwarder')
config.notify_forwarder.enable = true
end
end
Run Code Online (Sandbox Code Playgroud)
首先,我真的想对所有看到这篇文章并试图提供帮助的人表示诚挚的感谢。对此,我真的非常感激。事实证明,@ndberg 的上述帖子只回答了一半。按照上面的链接,这些是我“解决”此问题所采取的步骤
\n啊
\n步骤1:192.168.10.10不适用于VBox 6.1.28,要么将其更改为192.168.56.**(我使用了4,所以它192.168.56.4)并更新您的/etc/hosts文件以匹配,要么不执行任何操作...只需创建一个/etc/vbox/networks.conf文件并添加* 192.168.10.0/24到其中。我选择更新现有文件,但没有执行后者。
你还没完成
\n现在问题是最新的 Monterey OS 上的 Vagrant
\n步骤2:打开Vagrantfile并添加
\nconfig.vm.provider "virtualbox" do |v|\n v.gui = true\nend\nRun Code Online (Sandbox Code Playgroud)\n在 Homestead 附带的默认 Vagrantfile 中,我在第一个 if 语句之后添加了我的文件。这将在启动时打开 VM 窗口,并且您\xe2\x80\x99d 需要最小化/关闭该窗口。我猜我们正在等待 Vagrant 的更新来解决这个问题
\n它现在工作了
\n至此,我的 VirtualBox 之旅有了一个坚实的结论。多年来,我花了无数的时间来调试使用 VirtualBox 时出现的各种问题。是时候我尝试一下 docker 容器了。
\n再次感谢大家
\n| 归档时间: |
|
| 查看次数: |
1152 次 |
| 最近记录: |