I've just setup Homestead 2.0 vagrant server for Laravel 5 running on VirtualBox on OSX 10.10 (Yosemite) and it's running a lot slower than MAMP.
I really want to use Homestead, but the 1-3 second delay in loading pages is becoming really annoying, yet every load request is instant on MAMP.
Am I missing something on my setup?
Homestead.yaml:
---
ip: "192.168.10.10"
memory: 2048
cpus: 2
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: /Users/jackbarham/Code
to: /home/vagrant/Code
sites:
- map: tasks.mac
to: /home/vagrant/Code/tasks/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
hosts:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
192.168.10.10 tasks.mac
127.0.0.1 tasks-mamp.mac # MAMP PRO - Do NOT remove this entry!
I asked the same question on reddit/r/laravel and got the answer:
Locate the homestead.rb file in: /Users/username/.composer/vendor/laravel/homestead/scripts
Shut down the VM (homestead halt)
Open homestead.rb file, on line 49, under "# Register All Of The Configured Shared Folders" change:
from:
settings["folders"].each do |folder|
config.vm.synced_folder folder["map"], folder["to"], type: folder["type"] ||= nil
end
to:
settings["folders"].each do |folder|
config.vm.synced_folder folder["map"], folder["to"], type: folder["type"] ||= nil, :nfs => true
end
config.vm.network "private_network", type: "dhcp"
Power up (homestead up) and this should speed things up
Source: http://www.reddit.com/r/laravel/comments/2vvama/homestead_20_vagrant_and_virtualbox_running_a_lot
In my case using Windows as HOST is the same, it is because VirtualBox uses vboxsf as a file system to mount files from host to guest, I don't know why but it is too slow.
On the GUEST (Ubuntu 16.04) I mounted the working folder as a Network Folder using CIFS and runs a lot more faster.
On the guest side I use this: https://wiki.ubuntu.com/MountWindowsSharesPermanently
On the Host side (mac) I think you should follow this instructions: https://support.apple.com/kb/PH18707?locale=en_US
Related
I recently updated to Big Sur on my Mac and haven't been able to access any of my VMs as web pages since. I've destroyed and rebuilt this VM using Homestead's expected installation process.
VirtualBox 6.1.28
Latest Homestead version from release branch
Vagrant 2.2.18
This is the error I'm seeing
After long hours spent researching this loads of people seem to resolve it by adding the site to their hosts file. To confirm I have added this to hosts:
Error when viewing the URL without site in hosts
Update: I'm able to view the VM if I go to http://localhost:8000/. Going to http://192.168.10.10 doesn't work.
From the vagrant box using curl 192.168.10.10 produces the expected HTML output of that page. So does curl localhost:8000 from my machine. If I try curl 192.168.10.10 from my machine I get curl: (55) getpeername() failed with errno 22: Invalid argument.
I've tried every other network configuration within Virtualbox and using NAT is the only one that allows the SSH connection. It seems requests aren't making it to the VirtualBox.. probably because there's an error stating the socket isn't connected.
Socket stats seems to show it's listening on port 80
As of now I have destroyed and rebuilt the box again, so it is as close to an expected installation that anyone should have.
p.s. "site.test" is a placeholder for the actual name.
Here is my Homestead.yaml: https://pastebin.com/qhPdWCNv
---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Sites
to: /home/vagrant/code/
sites:
- map: site.test
to: /home/vagrant/code/site/public
php: "7.4"
databases:
- homestead
features:
- mysql: true
- mariadb: false
- postgresql: false
- ohmyzsh: false
- webdriver: false
services:
- enabled:
- "mysql"
# - disabled:
# - "postgresql#11-main"
#ports:
# - send: 33060 # MySQL/MariaDB
# to: 3306
# - send: 4040
# to: 4040
# - send: 54320 # PostgreSQL
# to: 5432
# - send: 8025 # Mailhog
# to: 8025
# - send: 9600
# to: 9600
# - send: 27017
# to: 27017
Here is my hosts file: https://pastebin.com/Y6Re15iy
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
192.168.10.10 site.test
::1 localhost
Vagrant 6.1.28 seems to restrict the valid IP address of a guest.
Took me hours to figure this out, read then manual.
Solved by changing my Homestead.yaml ip to 192.168.56.0 and also altered the ip in /etc/hosts
From the manual:
On Linux, Mac OS X and Solaris Oracle VM VirtualBox will only allow IP addresses in 192.68.56.0/21 range to be assigned to host-only adapters.
For anyone that encounters this issue I fixed this by updating the VM to a new IP, changing the domain, and clearing the dns cache (dscacheutil –flushcache).
Here is Homestead.yaml config :
ip: 192.168.9.10
memory: 2048
cpus: 2
provider: vmware_desktop
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
-
map: 'C:\Users\Khalil\RestfulAPI'
to: /home/vagrant/restfulapi
sites:
-
map: restfulapi.dev
to: /home/vagrant/restfulapi/public
php: "8.0"
databases:
- homestead
features:
-
mariadb: false
-
ohmyzsh: false
-
webdriver: false
name: restfulapi
hostname: restfulapi
I also added it to the hosts file : 192.168.9.10 restfulapi.dev
It works when i use http://restfulapi.local without mapping it directly as a site since i guess *.local is the default?
Running restfulapi.dev takes forever to load then gives a "connection time out", pinging the IP from my host responds with TTL expired in transit 4 times and ends with a
Ping statistics for 192.168.9.10:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
I can normally run vagrant ssh and ping 192.168.9.10 and get response, and it's also configured as eth1 on the machine when i run ip address show.
Tried provisioning, destroying the VM, setting up everything from scratch.
I attach my Homestead.yaml file for a test project that I am developing using Laravel Framework and PHPStorm.
[Homestead.yaml]
[1]: https://i.stack.imgur.com/VqkHh.png
After making changes to your Homestead.yaml file, execute
vagrant reload --provision
Once the virtual machine has finished booting, ssh into the VM through this command: vagrant ssh
Delete the version of php from your Homestead.yaml and run vagrant up and vagrant provision.
I am having trouble setting up my laravel project on my mac. I have (As far as I can tell) set up the homestead.yaml config correctly within my Homestead directory:
---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Documents/GitHub/project-darwin
to: /home/vagrant/code
sites:
- map: homestead.test
to: /home/vagrant/code/public
php: "7.2"
databases:
- homestead
After I have used vagrant up, on using vagrant ssh I can see my project inside of vagrant/code/project-darwin.
My hosts file is as follows:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
192.168.10.10 homestead.test
Which looks correct as is no different to what I normally do when running other laravel projects on virtualbox, however on going to my url, I get a 500 error and the same applies if I go directly to the ip (198.168.10.10).
A further thing I find suspicious is the following. When I use vagrant up, this is part of what shows in my terminal:
homestead-7: Waiting for machine to boot. This may take a few minutes...
homestead-7: SSH address: 127.0.0.1:2222
homestead-7: SSH username: vagrant
Should this ip be the same as the ip I supplied? Anyway, I have run out of ideas as to how to go about fixing this, any suggestions?
So it turns out my mac had auto selected . hyperv as my provider when I ran vagrant box add laravel/homestead, oh well..
In your Homestead.yaml config file you are doing the following:
Making a shared folder mapping project-darwin to /home/vagrant/code
folders:
- map: ~/Documents/GitHub/project-darwin
to: /home/vagrant/code
But under sites you are mapping the folder /home/vagrant/code/public to homestead.test, meaning when you are requesting homestead.test or the IP of your Vagrant Box, you are not calling upon project-darwin but rather the "empty" public folder.
sites:
- map: homestead.test
to: /home/vagrant/code/public
I would recommend either moving your code to the public folder or mapping sites to your desired destination.
Hope this helps :)
When I try to boot up Laravel Homestead on my MacBook Pro (OS X 10.12.3) it gets stuck on:
homestead-7: SSH address: 127.0.0.1:2222
homestead-7: SSH username: vagrant
homestead-7: SSH auth method: private key
And it will eventually time-out.
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
This is what my vagrant box displays:
My Homestead.yaml:
---
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
I'm running Vagrant 1.9.1 with VirtualBox 5.1.14.
Does anyone have an idea what the problem might be?
I solved it. Apparently I had to enable "Cable Connection" on my VM.
Laravel Homestead hangs at SSH auth method: private key on mac
https://github.com/mitchellh/vagrant/issues/7648#issuecomment-235282382
I am trying to install a Homestead VM for Laravel development on Debian Linux 8 with Vagrant 1.8.4 and VirtualBox 5.0.24 r108355.
Following the official documentation, I have installed Homestead and configured it in Homestead.yaml in the following way:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Code/dev.todoparrot.com
to: /home/vagrant/Code
sites:
- map: dev.todoparrot.com
to: /home/vagrant/Code/dev.todoparrot.com/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
To test it with a sample file, I have created an index.php in /home/user/Code/dev.todoparrot.com/public/ on my local machine that echos a string:
<?php echo "Hello from Homestead!"; ?>
I have also added dev.todoparrot.com to /etc/hosts:
127.0.0.1 localhost
127.0.1.1 debian
192.168.10.10 dev.todoparrot.com
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Within the Homestead folder of my local machine, the VM starts both via vagrant up and vagrant up --provision, but when I visit the domain http://dev.todoparrot.com/ in the browser, I get the following error:
No input file specified.
Any idea what could be wrong?
No input file specified
It says that you don't have any file in
/home/vagrant/Code/dev.todoparrot.com/public
For now, your Vagrant path is
/home/vagrant/Code/dev.todoparrot.com/
And you looking for dev.todoparrot.com/public in dev.todoparrot.com
That's your issue
You need change
folders:
- map: ~/Code/dev.todoparrot.com
to: /home/vagrant/Code
to:
folders:
- map: ~/Code
to: /home/vagrant/Code
It will emulate all folders in Code to /home/vagrant/Code/
Run vagrant up --provision after every update of Homestead.yaml
And in the future, you need to change/add only
sites:
- map: project-name.app
to: /home/vagrant/Code/ProjectName/public
Use vagrant ssh to check your current folders structure inside Code
If you already tried
vagrant up --provision
and still you getting 'No input file specified' error, try to run
vagrant reload --provision
reload vagrant box works for me.