简体   繁体   English

Laravel Homestead

[英]Laravel Homestead

I'm trying to get Laravel Homestead up and running. 我正试着让Laravel Homestead起来跑步。 I believe I did everything as manual says. 我相信我按手册说的做了一切。 When I run vagrant up -command I get following error on OS X 10.9: 当我运行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 foo@bar.com
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 foo@bar.com
"

Stdout from the command:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDkJjDXl7bdRlSQ453fsdOE7JZxk5x7b5XxeiQxS2Xitj1DiHTiVbNns71AflaNy+K2ev4SeazibpRrZnZ99Pnvd8XuJwScUZZzGaU/AsbQGDUNuQU4Wa047XhG28uHlfZNM/X3kMmsC73QtyByUDFadTAz2SjhwCBkatmpu8aSwOAtkNDTg+0QLql6yfIHaV5tn8DLBRhWWovpBcrU8aopG+7jgVpHghaIDq/1SmgclOt9paLZV333s9b8f/qCm4zc6sRFCvdKrIYgSutYnXTRkLRXm8oor8/R6kvpxD6D6sX5e0+rDWgdxCthC2/pqWaZ/B76Pa7F5Zlt9lDxXzAR foo@bar.com


Stderr from the command:

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

Map your projects directory 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 projects directory anyway. 这应该解决你的问题,你可能不希望你的vagrant的配置文件( .ssh.bashrc等)同步回到你的本地projects目录。

Also your keys property should be set to private key, not public. 您的keys属性也应设置为私钥,而不是公共密钥。

If you look at original Homestead.yaml again, you'll see that: 如果再次查看原始的Homestead.yaml,您会看到:

authorize needs your public key (id_rsa.pub) authorize需要您的公钥(id_rsa.pub)

keys needs your privte key (id_rsa) keys需要你的私钥(id_rsa)

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

Homestead is just an implementation of vagrant. Homestead只是一个流浪汉的实现。

Try: 尝试:

homestead up 宅基地

If this still doesn't work, try 如果这仍然不起作用,请尝试

homestead destroy && homestead up 宅基地破坏和宅基地

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. Homestead为初学者提供了一个很好的方式,可以立即使用Laravel Framework。 However, I think the vagrant settings and weird environment is not straight forward to me. 但是,我认为流浪汉的设置和奇怪的环境并不是我直截了当的。

I believe everyone has to work with the real Server and Laravel environment eventually. 我相信每个人最终都必须使用真正的Server和Laravel环境。 Therefore, I decided to give up homestead and simply install Ubuntu on VirtualBox. 因此,我决定放弃家园,只需在VirtualBox上安装Ubuntu。 Then, I followed official instructions here and installed my Laravel pretty easily. 然后,我按照这里的官方说明轻松地安装了我的Laravel。

Just for your information. 仅供参考。 Just go straight to the real Laravel system instead of Homestead. 直接去真正的Laravel系统而不是Homestead。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM