Jack Barham
Jack Barham

Reputation: 3209

Homestead 2.0, Vagrant and VirtualBox running a lot slower than MAMP

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!

Upvotes: 3

Views: 2090

Answers (2)

Jack Barham
Jack Barham

Reputation: 3209

I asked the same question on reddit/r/laravel and got the answer:

  1. Locate the homestead.rb file in: /Users/username/.composer/vendor/laravel/homestead/scripts

  2. Shut down the VM (homestead halt)

  3. 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" 
  1. 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

Upvotes: 2

Cristian Sepulveda
Cristian Sepulveda

Reputation: 1730

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

Upvotes: 0

Related Questions