Laravel Homestead/Vagrant/Virtualbox is slow on Windows

后端 未结 2 773
挽巷
挽巷 2020-12-23 15:06

I have installed Laravel Homestead/Vagrant/Virtualbox on Windows as it said on official site

But it is really slow. Page update takes about

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-23 15:46

    NFS stands for Network File System and you need it for speed.

    Laravel homestead tutorial does not say what NFS is and why you need it, which is why I ignored it on the initial install.

    1) On your Windows host, install the plugin that adds NFS support to vagrant in Windows.

    $ vagrant plugin install vagrant-winnfsd
    

    2) Go to Homestead.yaml, it usually sits in C:\Users\username\Homestead\Homestead.yaml

    3) Add type: "nfs" in the folders section like so:

    folders:
        - map: ~/code
          to: /home/vagrant/code
          type: "nfs"
    

    4) Run vagrant up --provision

    Result:

    The speed increases, as in @phazei's answer, from 8 to 2 seconds for each request, but it is much less work. @phazei's answer clarifies some background processes.

    I tested it on windows 10 with Oracle Virtualbox-5.2.12, vagrant version-2.1.1.

    Please note: Vagrant NFS page says

    Windows users: NFS folders do not work on Windows hosts. Vagrant will ignore your request for NFS synced folders on Windows.

    But if you have the plugin, you can ignore it.

提交回复
热议问题