Laravel 家园

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23709039/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 09:31:44  来源:igfitidea点击:

Laravel Homestead

phplaravelvagrant

提问by AxlSmith

I'm trying to get Laravel Homestead up and running. I believe I did everything as manual says. When I run vagrant up -command I get following error on OS X 10.9:

我正在尝试启动并运行 Laravel Homestead。我相信我按照手册所说的做了一切。当我运行 vagrant up -command 时,在 OS X 10.9 上出现以下错误:

My Homestead.yaml file is following:

我的 Homestead.yaml 文件如下:

---
authorize: /Users/foo/.ssh/id_rsa.pub

keys:
    - /Users/foo/.ssh/id_rsa.pub

folders:
    - map: /Users/foo/projects
      to: /home/vagrant

sites:
    - map: site.dev
      to: /home/vagrant/site/public

And this is what I get while executing vagrant up:

这就是我在执行时得到的vagrant up

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'laravel/homestead' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'laravel/homestead'
    default: URL: https://vagrantcloud.com/laravel/homestead
==> default: Adding box 'laravel/homestead' (v0.1.6) for provider: virtualbox
    default: Downloading: https://vagrantcloud.com/laravel/homestead/version/7/provider/virtualbox.box
==> default: Successfully added box 'laravel/homestead' (v0.1.6) for 'virtualbox'!
==> default: Importing base box 'laravel/homestead'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Setting the name of the VM: Homestead_default_1400312360757_29263
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 80 => 8000 (adapter 1)
    default: 3306 => 33060 (adapter 1)
    default: 5432 => 54320 (adapter 1)
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => /Users/foo/Homestead
    default: /home/vagrant => /Users/foo/Projects
==> default: Running provisioner: shell...
    default: Running: inline script
==> default: tee: 
==> default: /home/vagrant/.ssh/authorized_keys
==> default: : No such file or directory
==> default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDkJjDXl7bdRlSQ453fsdOE7JZxk5x7b5XxeiQxS2Xitj1DiHTiVbNns71AflaNy+K2ev4SeazibpRrZnZ99Pnvd8XuJwScUZZzGaU/AsbQGDUNuQU4Wa047XhG28uHlfZNM/X3kMmsC73QtyByUDFadTAz2SjhwCBkatmpu8aSwOAtkNDTg+0QLql6yfIHaV5tn8DLBRhWWovpBcrU8aopG+7jgVpHghaIDq/1SmgclOt9paLZV333s9b8f/qCm4zc6sRFCvdKrIYgSutYnPTRkLRXm8ooX8/R6kvpxD6D6ss5e0+rDWgdxCthC2/pqWaZ/B76Pa7FXZlt9lDx7zAR [email protected]
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

chmod +x /tmp/vagrant-shell && /tmp/vagrant-shell "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDkJjDXl7bdRlSQ453fsdOE7JZxk5x7b5XxeiQxS2Xitj1DiHTiVbNns71AflaNy+K2ev4SeazibpRrZnZ99Pnvd8XuJwScUZZzGaU/AsbQGDUNuQU4Wa047XhG28uHlfZNM/X3kMmsC73QtyByUDFadTAz2SjhwCBkatmpu8aSwOAtkNDTg+0QLql6yfIHaV5tn8DLBRhWWovpBcrU8aopG+7jgVpHghaIDq/1SmgclOt9paLZV333s9b8f/qCm4zc6sRFCvdKrIYgSutYnPTRkLRXm8ooX8/R6kvpxD6D6ss5e0+rDWgdxCthC2/pqWaZ/B76Pa7F5ZlX9lDx7zAR [email protected]
"

Stdout from the command:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDkJjDXl7bdRlSQ453fsdOE7JZxk5x7b5XxeiQxS2Xitj1DiHTiVbNns71AflaNy+K2ev4SeazibpRrZnZ99Pnvd8XuJwScUZZzGaU/AsbQGDUNuQU4Wa047XhG28uHlfZNM/X3kMmsC73QtyByUDFadTAz2SjhwCBkatmpu8aSwOAtkNDTg+0QLql6yfIHaV5tn8DLBRhWWovpBcrU8aopG+7jgVpHghaIDq/1SmgclOt9paLZV333s9b8f/qCm4zc6sRFCvdKrIYgSutYnXTRkLRXm8oor8/R6kvpxD6D6sX5e0+rDWgdxCthC2/pqWaZ/B76Pa7F5Zlt9lDxXzAR [email protected]


Stderr from the command:

tee: /home/vagrant/.ssh/authorized_keys: No such file or directory

回答by Kestutis

Map your projectsdirectory to something else than /home/vagrant:

将您的projects目录映射到其他内容/home/vagrant

folders:
- map: /Users/foo/projects
  to: /home/vagrant/projects

This should fix your problem and you probably don't want your vagrant's config files (.ssh, .bashrc, etc) synced back to your local projectsdirectory anyway.

这应该可以解决你的问题,你可能不希望您的无业游民的配置文件(.ssh.bashrc同步回本地,等等)projects目录反正。

Also your keysproperty should be set to private key, not public.

此外,您的keys财产应设置为私钥,而不是公开的。

回答by Antonio Carlos Ribeiro

If you look at original Homestead.yaml again, you'll see that:

如果您再次查看原始 Homestead.yaml,您会看到:

authorizeneeds your public key (id_rsa.pub)

authorize需要你的公钥(id_rsa.pub)

keysneeds your privte key (id_rsa)

keys需要你的私钥(id_rsa)

回答by gristoi

keys should be:

键应该是:

keys: - /Users/foo/.ssh/id_rsa not keys: - /Users/foo/.ssh/id_rsa.pub

键: - /Users/foo/.ssh/id_rsa 不是键: - /Users/foo/.ssh/id_rsa.pub

回答by fwartner

Homestead is just an implementation of vagrant.

Homestead 只是 vagrant 的一个实现。

Try:

尝试:

homestead up

宅基地向上

If this still doesn't work, try

如果这仍然不起作用,请尝试

homestead destroy && homestead up

宅基地摧毁&&宅基地上升

回答by Dean Chiu

A little suggestion here based on my own learning experience. Homestead provides a nice and neat way for beginners to work on Laravel Framework in no time. However, I think the vagrant settings and weird environment is not straight forward to me.

在这里根据我自己的学习经验提出一点建议。Homestead 为初学者提供了一种很好且简洁的方式来立即使用 Laravel 框架。然而,我认为流浪的设置和怪异的环境对我来说并不简单。

I believe everyone has to work with the real Server and Laravel environment eventually. Therefore, I decided to give up homestead and simply install Ubuntu on VirtualBox. Then, I followed official instructions hereand installed my Laravel pretty easily.

我相信每个人最终都必须使用真正的 Server 和 Laravel 环境。因此,我决定放弃宅基地,直接在 VirtualBox 上安装 Ubuntu。然后,我按照此处的官方说明轻松安装了我的 Laravel。

Just for your information. Just go straight to the real Laravel system instead of Homestead.

仅供参考。直接进入真正的 Laravel 系统而不是 Homestead。