環境
Homestead box:
Homestead: v8.2.0
vagrant: 2.2.4
- 在
Homestead中 安裝nfs-kernel-server
sudo apt-get install nfs-kernel-server
rpcinfo -p
- 編輯
Homestead.yaml文件,給folders:節點下的to:下面新增type: nfs
如:
ip: "192.168.10.10"
memory: 4098
cpus: 1
provider: virtualbox
box: laravel/homestead
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: D:/workspace/php/laravel
to: /home/vagrant/code/laravel
type: nfs
- 安裝 vagrant
vagrant-winnfsd插件
vagrant plugin install vagrant-winnfsd
- 重啟
vagrant
vagrant provision
vagrant reload
在運行了vagrant reload之后,mount.nfs 連接超時
[NFS] Status: halted
[NFS] Start: started
==> homestead-7: Mounting NFS shared folders...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mount -o vers=3,udp,actimeo=1,nolock,noatime 192.168.10.1:/D/workspace/php/laravel1 /home/vagrant/code/laravel1
Stdout from the command:
Stderr from the command:
mount.nfs: Connection timed out
如果需要掛載的站點訪問快,在 Homestead.yaml的folders 下添加type: nfs,但不可以給太多站點加type: nfs,可能會出現mount.nfs: Connection timed out 的提示錯誤,導致掛載文件夾失敗
References
- 解決vagrant上使用Homestead很慢(響應速度10s+)
- I get this during the mount 發現 Homestead.yaml 文件 中可以添加
mongodb: false mariadb: false postgresql: false - mount.nfs: Connection timed out 安裝了``
- VirtualBox 虛擬機里網絡很慢的解決方法 了解到
time可以獲取請求時間
