I have been attempting getting this to work now for 4 hours now and I am struggling.
I am trying to get my homestead working. I followed the installation guide here:
https://laravel.com/docs/5.2/homestead
I have a few questions:
1.) When I install homestead by cloning the github repo - I get a src folder in that installation and in that src folder I have this: src/stubs/Homestead.yaml. When I followed the instructions I ran bash init.sh inside of the root of that installation and that created a /.homestead folder with 3 files in it a after.sh a aliases and a Homestead.yml file. From my understanding I am to modify the Homestead.yml to reflect my enviornment. The question is which one? The one in the hidden .homestead folder or the one in the place where I installed Homestead?
2.) When I go to http://site1.local:8000/ in a browser I get a Site cannot be reached error - refused to connect. When i go to http://localhost:8000/ I get 'No input file specified.'
3.) The command Homestead from the command line isn't recognized as a internal or external command - should it be? I read people with similar problems should run the command homestead up yet it isn't recognized for me.
Here is my Homestead.yml file:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/LaravelProjects/projects
to: /home/vagrant/Code
sites:
- map: site1.local
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
Here is my host file:
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
#laravel project 1
192.168.10.10 site1.local
I have updated my hosts file. I have tried running vagrant reload --provision and vagrant destroy and other vagrant commands without luck. Any suggestions?
Here is the dump of running vagrant reload --provision
==> default: Attempting graceful shutdown of VM...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Clearing any previously set forwarded ports...
==> 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 (guest) => 8000 (host) (adapter 1)
default: 443 (guest) => 44300 (host) (adapter 1)
default: 3306 (guest) => 33060 (host) (adapter 1)
default: 5432 (guest) => 54320 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (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: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 5.0.20
default: VirtualBox Version: 5.1
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => C:/Users/Radley.Anaya/LaravelProjects/Homestead
default: /home/vagrant/Code => C:/Users/Radley.Anaya/LaravelProjects/projects
==> default: Running provisioner: file...
==> default: Running provisioner: shell...
default: Running: inline script
==> default: Running provisioner: shell...
default: Running: inline script
==> default: Running provisioner: shell...
default: Running: C:/Users/RADLEY~1.ANA/AppData/Local/Temp/vagrant-shell20160801-10000-y9i8nr.sh
==> default: Running provisioner: shell...
default: Running: script: Creating Site: site1.local
==> default: Running provisioner: shell...
default: Running: script: Restarting Nginx
==> default: Running provisioner: shell...
default: Running: script: Creating MySQL Database
==> default: Running provisioner: shell...
default: Running: script: Creating Postgres Database
==> default: Running provisioner: shell...
default: Running: script: Clear Variables
==> default: Running provisioner: shell...
default: Running: inline script
==> default: You are already using composer version 1.2.0 (stable channel).
==> default: Running provisioner: shell...
default: Running: C:/Users/RADLEY~1.ANA/AppData/Local/Temp/vagrant-shell20160801-10000-i2qk4o.sh
Update
I ssh'd into the VM and my folder structure looks like: Code/first/index.php how do I update it?
My Homestead.yml file has a different directory structure - I think that is likely causing my issues. How do I fix this?
From my understanding the .yml file dictates the folder structure of the virtual machine? This isn't the case??
Solved
My mappings were messed up. I ssh'd into the vm to verify and updated my .yaml file then provisioned the vm and everything is working. Also I had to remove the port from my url.
Related
on ubuntu16x64 + virtualbox + vagrant
I'm trying add the laravel/homestead box
I get error in
$ Vagrant up
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> 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-7
==> 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 (guest) => 8000 (host) (adapter 1)
default: 443 (guest) => 44300 (host) (adapter 1)
default: 3306 (guest) => 33060 (host) (adapter 1)
default: 5432 (guest) => 54320 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (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:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
/sbin/ifdown eth1 2> /dev/null
Stdout from the command:
Stderr from the command:
the output refers to a problem with the generated keys
I am not familiar with the key generation, so perhaps the problem is there, I report the steps I did to create them, maybe I made some big stupid
$ cd /home/ubiagio/.ssh/
$ ssh-keygen -t rsa -C biagiopas#yahoo.it
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ubiagio/.ssh/id_rsa): biagiopas_sshrsakey
two keys generated
/home/ubiagio/.ssh/
biagiopas_ssh_key
biagiopas_ssh_key.pub
////////////////////////////////////////////
configuration
~/.homestead/Homestead.yaml
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
#authorize: ~/.ssh/id_rsa.pub
authorize: ~/.ssh/biagiopas_ssh_key.pub
keys:
# - ~/.ssh/id_rsa
- ~/.ssh/biagiopas_sshrsakey
folders:
- map: ~/Code
to: /home/vagrant/Code
sites:
- map: laraveltestblog01.app
to: /var/www/html/laravel/testblog01/public
////////////////////////////////////////////
if the cause is not due to the keys, then may be another problem encountered before
Launching The Vagrant Box
$ cd /home/ubiagio/Homestead/
$ vagrant up
This Vagrant environment has specified that it requires the Vagrant
version to satisfy the following version requirements:
>= 1.8.4
You are running Vagrant 1.8.1, which does not satisfy
these requirements. Please change your Vagrant version or update
the Vagrantfile to allow this Vagrant version. However, be warned
that if the Vagrantfile has specified another version, it probably has
good reason to do so, and changing that may cause the environment to
not function properly.
I tried to upgrade with
$ Sudo apt upgrade
but without success
so I manually changed the Vagrantfile
$ gedit /home/ubiagio/Homestead/Vagrantfile
#Vagrant.require_version '>= 1.8.4'
Vagrant.require_version '>= 1.8.1'
thanks from now for the help
I have installed virtual box, vagrant, git bash. everything runs well.
when I command 'vagrant up', no errors shows.
forhad#BlindMirror MINGW64 ~/Homestead (master)
$ vagrant reload --provision
==> default: [vagrant-hostsupdater] Removing hosts
==> default: Attempting graceful shutdown of VM...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> 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: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: [vagrant-hostsupdater] Checking for host entries
==> default: Mounting shared folders...
default: /vagrant => C:/Users/forhad/Homestead
forhad#BlindMirror MINGW64 ~/Homestead (master)
but when I enter website address on browser, it shows http://laravel.dev is not available.
url containing port 2222 works, e.g 127.0.0.1:2222, it shows
SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6
on the browser.
no other url works,
Homestead.yaml file:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: C:/Users/forhad/Homestead
to: /home/vagrant/Code
sites:
- map: laravel.dev
to: /home/vagrant/Code/Laravel/public
databases:
- homestead
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
#ports:
# - send: 93000
# to: 80
# - send: 7777
# to: 777
# protocol: udp
I'm trying to get a Homestead VM setup for my laravel project. I have followed the instructions here exactly. The only difference is the folder I put the Homestead directory in; I simply put it in C:/.
Otherwise I have set up the Vagrant box, cloned and inited Homestead, and set up the homestead.yaml file exactly as instructed. I then start the VM with vagrant ssh. When I use ls to view the folders in the mapped directory - nothing.
This is my homestead.yaml file:
p: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/ssh/id_rsa.pub
keys:
- ~/ssh/id_rsa.pub
folders:
- map: c:/laravelprojects
to: /home/vagrant/Code
sites:
- map: app.dev
to: /home/vagrant/Code/username/public
databases:
- homestead
When I run vagrant up, this is the output:
Bringing machine 'default' up with 'virtualbox' provider...
==> 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-7
==> 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 (guest) => 8000 (host) (adapter 1)
default: 443 (guest) => 44300 (host) (adapter 1)
default: 3306 (guest) => 33060 (host) (adapter 1)
default: 5432 (guest) => 54320 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (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: Remote connection disconnect. Retrying...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> 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 => C:/Homestead
As you can see, the last two lines seem to be mounted the wrong folder, ie the folder the Vagrant machine is being started from. However, checking in Virtualbox shows that both this and the folder specified in the .yaml file are set and mapped.
What gives?
/vagrant is mounted by default from the project where Vagrantfile is.
I am not sure if it can be disable from homestead.yaml file directly, but you can edit the Vagrantfile and add
config.vm.synced_folder ".", "/vagrant", disabled: true
so it will not create a /vagrant directory in the VM and VirtualBox will show only your folder specified from the yaml.
I am using Vagrant/Homestead combo with Laravel 5.2 and I tried to make HTTP calls to the server and something broke but I don't know why, I kept getting a 405 bad gateway error and someone recommended I just create a new vagrant box.
So I went to my VirtualBox Manager and deleted my homestead box/deleted all files as well, then ran vagrant up to create a new one and I was able to ssh just fine but now when I try to make a HTTP call, namely in Postman, I get:
<html>
<head>
<title>502 Bad Gateway</title>
</head>
<body bgcolor="white">
<center>
<h1>502 Bad Gateway</h1>
</center>
<hr>
<center>nginx/1.9.7</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
When running vagrant up, I get this error (look at the very last line):
Lansana#DESKTOP-UV14VGF MINGW64 ~/Homestead (master) $ vagrant up Bringing machine 'default' up with 'virtualbox' provider...
==> 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: 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: 443 => 44300 (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:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> 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 => C:/Users/Lansana/Homestead
default: /home/vagrant/Sites => C:/Users/Lansana/Homestead/Projects
==> default: Running provisioner: file...
==> default: Running provisioner: shell...
default: Running: inline script
==> default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4q2BHIAHJ/yUc9zwJVCUbtbPe5xPJmbsbUJmtjldEnaIZ00tG/memsDHbOlGsbTxRU2QgKmrKSu7Iz8r+FglDbXLzbrg0O9rrQWi9FCpl8J630o1/fz3vejVIslcnuRBtiW/UUjYTZ5vsU2E/aMmxJFA31IzWslmQKHzOW+2XHyQ3e8QQBI7owA4QpVHtki0g0xlISA+H7kgG90NY0uEF+t4GK0KY/CN2GzxMFCAxtXLa2M8uGimySImsPBZByMNuLsdiok8W8vLWtDr9qvXhQkXOpxSTUflfCiJQmOke3hJpjWGPCcaVg9gPmr3wH9GUKnGQJ6SPQlslMI+Mekr/ lansana#homestead
==> default: Running provisioner: shell...
default: Running: inline script
==> default: Running provisioner: shell...
default: Running: C:/Users/Lansana/AppData/Local/Temp/vagrant-shell20160109-5024-pucyip.sh
==> default: Running provisioner: shell...
default: Running: C:/Users/Lansana/AppData/Local/Temp/vagrant-shell20160109-5024-1dw603v.sh
==> default: nginx stop/waiting
==> default: nginx start/running, process 1943
==> default: php5-fpm: unrecognized service The SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed. The output for this command should be in the log above. Please read the output to determine what went wrong.
Anyone know what is going wrong here?
Try doing the following:
$ composer remove laravel/homestead
$ composer clear-cache
$ composer require laravel/homestead
$ vagrant destroy && vagrant up
For some reason, doing a composer update laravel/homestead didn't grab the latest version of the homestead files (I think it has something to do with the composer.json using "^3.0", and didn't think 3.0.1 required an update or something), I noticed homestead.rb was not the current version.
I do not know where I got stuck, I used already homestead and can not figure out the problem. The virtual machine runs correctly, folders are also mirrored correctly.
$ vagrant reload
==> default: Attempting graceful shutdown of VM...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Clearing any previously set forwarded ports...
==> 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: 443 => 44300 (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 => C:/Users/Roko/Homestead
default: /home/vagrant/Code => C:/Users/Roko/Homestead/Code
default: /home/vagrant/Code/geogram => C:/Users/Roko/Homestead/Code/geogram
default: /home/vagrant/Code/phpmyadmin => C:/Users/Roko/Homestead/Code/phpmyadmin
default: /home/vagrant/Code/Laravel/public => C:/Users/Roko/Homestead/Code/Laravel/public
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: to force provisioning. Provisioners marked to run always will still run.
I added entries to the hosts file:
127.0.0.1 phpmyadmin.app
127.0.0.1 homestead.app
and this is YAML file:
ip: "192.168.10.10"
memory: 1048
cpus: 1
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Homestead/Code
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
- map: phpmyadmin.app
to: /home/vagrant/Code/phpmyadmin/
databases:
- homestead
variables:
- key: APP_ENV
value: local
And I still get This web page is not available for http://homestead.app:8000/
Can someone figure out what am I doing wrong?
Did you tried vagrant reload --provision
Your vagrant up and the Homestead.yaml configruation is fine. But the ip address inside your hosts file should be 192.168.10.10 so to resolve this edit the hosts file acordingly
(read documentation https://laravel.com/docs/5.2/homestead)
192.168.10.10 phpmyadmin.app
192.168.10.10 homestead.app
then reload your vagrant using provision
vagrant reload --provision
That should do it.
use 192.168.10.10 in your /etc/hosts
Example..
192.168.10.10 Laravel.app