Speeding up Homestead on Windows Using NFS
Speeding up Homestead on Windows Using NFS
Sep 07 2015
EDIT: I have another article on using Homestead with sFTP and Sublime which may be a better option for some.
I recently took the plunge into getting a Homestead vagrant box setup locally for development. I followed the instructions on the Laravel docs page and all went well. It took me only about ten minutes to get everything working within Homestead, awesome!
But wait, why is everything so slow? I started searching Google and it seems it's a common problem for Windows. It seems the trick is to enable nfs
support for windows and boot your folders using the nfs
file system.
It took a bit of searching and tinkering so thought I would share the few simple steps it takes to enable nfs
for vagrant on Windows.
Install NFS Plugin
Just run this install for the plugin from anywhere.
vagrant plugin install vagrant-winnfsd
Update homestead.rb
There is some weird bug here, not sure why it hasn't been pushed into the main repo yet, but you will need to replace some code here (if not already live).
homestead/scripts/homestead.rb
Replace the following:
if settings.include? 'folders'
settings["folders"].each do |folder|
mount_opts = []
if (folder["type"] == "nfs")
mount_opts = folder["mount_opts"] ? folder["mount_opts"] : ['actimeo=1']
end
config.vm.synced_folder folder["map"], folder["to"], type: folder["type"] ||= nil, mount_options: mount_opts
end
end
With this:
if settings.include? 'folders'
settings["folders"].sort! { |a,b| a["map"].length <=> b["map"].length }
settings["folders"].each do |folder|
config.vm.synced_folder folder["map"], folder["to"],
id: folder["map"],
:nfs => true,
:mount_options => ['nolock,vers=3,udp,noatime']
end
end
Update Homestead.yaml
We can now use nfs
in the folders section of the homestead config file.
folders:
- map: ~\projects
to: /home/vagrant/Code
type: nfs
Rebooting
You may also need a reboot at this point especially if you've been playing around to try and get this working.
First make sure you remove any vm in your VirtualBox
and also check the ~\VritualBox VMs
folder to make sure everything is deleted.
After a reboot try vagrant up
again and it should spin up a new box. I found when I added folders I had to go through this each time. Fortunately that doesn't happen often at all.
Disable Sendfile
This is on a bit of a side note, but it's also recommended that sendfile
for Nginx be disabled.
> sudo vi /etc/nginx/nginx.conf
And change sendfile
from on
to off
.
Speeding up Homestead on Windows Using NFS的更多相关文章
- How to setup Laravel Homestead in Windows
How to setup Laravel Homestead in Windows by JBorbón 17. March 2017 PHP 8 Developing with PHP u ...
- Windows挂载NFS共享盘
Centos7添加NFS方法请见如下链接: https://www.cnblogs.com/jackyzm/p/10285845.html 一:添加NFS服务 1.1:此电脑-右键-管理-window ...
- CentOS挂Windows的NFS备忘
Windows NFS 安装和配置 注:需要将名称为“所有计算机”的访问类型改为“无访问权限”,再将可访问IP的访问类型改为“读写”,并勾选“允许根目录访问” ,如WINDOWS有防火墙开放“204 ...
- 解决windows 挂载 nfs 驱动器中 中文乱码问题
乱码问题,是由于 mount.nfs 命令不支持 utf-8字符集.所以是系统软件支持的问题.在网络上找了很多方案都没能解决. 网上主要有三种方案(1)换解决方案,使用smb 共享,这等于不是解决方法 ...
- Windows挂载NFS目录权限问题
windows挂载Linux上的NFS后, 可能会出现没有权限打开文件的问题 解决方法: 在注册表中添加匿名用户的默认UID和GID 计算机\HKEY_LOCAL_MACHINE\SOFTWA ...
- Windows Mount NFS Share from e.g. Linux
Note: Not Stable, so steps below are for reference only ************ Linux Configuration NFS Share 1 ...
- Windows下NFS服务器SFU设置(可以共享linux系统)
一.安装SFU1.下载软件SFU http://download.microsoft.com/download/a/1/c/a1ca7af1-a6e3-46e7-874a-4c5d8c0fb3b7/S ...
- windows挂载nfs
注意:Win10 Creators Update前只有Win10企业版可以挂载NFS, Creators Update后专业版也可挂载NFS了. 安装 按Win+R输入OptionalFeatures ...
- Homestead can not mount nfs on macos catalina
It's not a vagrant issue but nfsd/macos issue.If you add to /etc/exports line:/Users/USERNAME/Docume ...
随机推荐
- bootstrap3中模态框的数据编辑使用方法
模态框是bootstrap3中比较好用得弹窗控件,这回使用了 说主要的,官方详细教程 http://www.runoob.com/bootstrap/bootstrap-modal-plugin.ht ...
- hdu 4370 0 or 1,最短路
题目描述 给定n * n矩阵C ij(1 <= i,j <= n),我们要找到0或1的n * n矩阵X ij(1 <= i,j <= n). 此外,X ij满足以下条件: 1. ...
- as3 typeof 对象类型与返回结果对照表 is as
is 和as 运算符使用很广泛.is 用来判断一个对象是否属于一种类型,返回布尔值,true 代表属于,false 表示不属于.使用格式如下:trace (9 is Number); //输出:tru ...
- vim-git for window 默认编辑器
vim其实是linux的一个文本编辑器,所以 vi+文件名 后,其实是进入vi程序了.vi有两种模式,编辑模式和命令模式 在命令模式下,我们可以直接按 i ,此时就会切换到编辑模式,如上图,下方有个i ...
- Java LinkedList的实现原理
LinkedList是Java List类型的集合类的一种实现,此外,LinkedList还实现了Deque接口.本文基于Java1.8,对于LinkedList的实现原理做一下详细讲解. (Java ...
- Haskell语言学习笔记(35)Contravariant
contravariant 模块 contravariant 模块需要安装 $ cabal install contravariant contravariant-1.4 Prelude> :m ...
- L2tp协议简单解析
1.L2TP简介 L2TP(Layer 2 Tunneling Protocol,二层隧道协议)是VPDN(Virtual PrivateDial-up Network,虚拟私有拨号网)隧道协议的一种 ...
- 显示AVI的第一桢
procedure TForm1.Button1Click(Sender: TObject);begin Application.ProcessMessages; MediaPlayer1.Ope ...
- @Transactionl注解
spring 事务注解 默认遇到throw new RuntimeException("...");会回滚 需要捕获的throw new Exception("...&q ...
- mysql中binlog_format的三种模式
mysql复制主要有三种方式:基于SQL语句的复制(statement-based replication, SBR),基于行的复制(row-based replication, RBR),混合模式复 ...