【问题标题】:Laravel homestead Vagrant ssh errorLaravel宅基地Vagrant ssh错误
【发布时间】:2017-09-13 03:26:59
【问题描述】:

在尝试安装 Laravel Homestead 5 小时后,我需要帮助.. 我在 hetzner 上有 CX 服务器 安装 Ubuntu 16.04 安装 virtualbox 和 vagrant

在尝试通过文档逐步安装 laravel homestead 之后, 但是当 vagrant 尝试通过 ssh 连接到虚拟机时出现错误..

我不知道是什么问题。

vagrant ssh-config

Host homestead-7
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /root/.vagrant.d/insecure_private_key
  IdentitiesOnly yes
  LogLevel FATAL
  ForwardAgent yes

Vargantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

require 'json'
require 'yaml'

VAGRANTFILE_API_VERSION ||= "2"
confDir = $confDir ||= File.expand_path(File.join(Dir.home, ".homestead"))

homesteadYamlPath = confDir + "/Homestead.yaml"
homesteadJsonPath = confDir + "/Homestead.json"
afterScriptPath = confDir + "/after.sh"
aliasesPath = confDir + "/aliases"

require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')

Vagrant.require_version '>= 1.8.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 "shell" do |s|
          s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /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))
    end

    Homestead.configure(config, settings)

    if File.exist? afterScriptPath then
        config.vm.provision "shell", path: afterScriptPath, privileged: false
    end

    if defined? VagrantPlugins::HostsUpdater
        config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
    end
end

vagrant ssh

ssh_exchange_identification: read: Connection reset by peer

调试信息:

DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
DEBUG virtualbox_5_1:   - [1, "ssh", 2222, 22, "127.0.0.1"]
DEBUG virtualbox_5_1:   - [1, "tcp27017", 27017, 27017, ""]
DEBUG virtualbox_5_1:   - [1, "tcp33060", 33060, 3306, ""]
DEBUG virtualbox_5_1:   - [1, "tcp44300", 44300, 443, ""]
DEBUG virtualbox_5_1:   - [1, "tcp54320", 54320, 5432, ""]
DEBUG virtualbox_5_1:   - [1, "tcp8000", 8000, 80, ""]
DEBUG ssh: Checking key permissions: /root/.vagrant.d/insecure_private_key
 INFO ssh: Invoking SSH: ssh ["vagrant@127.0.0.1", "-p", "2222", "-o", "Compression=yes", "-o", "DSAAuthentication=yes", "-o", "LogLevel=FATAL", "-o", "IdentitiesOnly=yes", "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null", "-i", "/root/.vagrant.d/insecure_private_key", "-o", "ForwardAgent=yes"]

需要任何建议!

【问题讨论】:

  • 您必须检查您是否拥有最新版本的 vagrant box,我曾经遇到过同样的问题,但升级到 v2.0 后解决了

标签: laravel ssh vagrant virtualbox homestead


【解决方案1】:

如果你已经生成了 homestead.yaml 文件,你可能需要使用 ssh-keygen -t rsa -C “your_email@example.com” 在你的主目录中为 laravel 生成你的 ssh 文件,你需要配置你的 homestead.yaml 文件以指向你的 ssh 所在的目录文件下载完毕可以参考这段代码homestead.yamel默认配置

ip: “192.168.10.10”
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
 — ~/.ssh/id_rsa
folders:
 — map: ~/Code
 to: /home/vagrant/Code
sites:
 — map: homestead.app
 to: /home/vagrant/Code/Laravel/public
databases:
 — homestead
# blackfire:
# — id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# — send: 50000
# to: 5000
# — send: 7777
# to: 777
# protocol: udp`

根据您的系统信息更新信息

`ip: “192.168.10.10”
memory: 1024
cpus: 1
provider: virtualbox
authorize: c:/Users/User/.ssh/id_rsa.pub
keys:
 — c:/Users/User/.ssh/id_rsa
folders:
 — map: e:/Homestead_Projects
 to: /home/vagrant/Code
sites:
 — map: homestead.app
 to: /home/vagrant/Code/Laravel/public
databases:
 — homestead
# blackfire:
# — id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# — send: 50000
# to: 5000
# — send: 7777
# to: 777
# protocol: udp 

希望对你有帮助

请记住,您在此处所做的任何更改都需要运行 vagrant reload --provision 命令。

希望这对你有用。

【讨论】:

    猜你喜欢
    • 2015-02-28
    • 1970-01-01
    • 2014-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-09
    • 2015-04-24
    • 2015-09-06
    相关资源
    最近更新 更多