这是坚持技术写做计划(含翻译)的第37篇,定个小目标999,每周最少2篇。node
本文介绍两种vagrant up后自动同步文件(rsync) 分别基于 sync
和 nfs
(若是不设置的话,须要再起一个终端,单独运行 vagrant rsync-auto
)python
python+vagrant+virtualbox系列文章
linux
config.vm.synced_folder ".", "/vagrant", type: "rsync",
# rsync__verbose: true,
# rsync__auto: true,
rsync__exclude: ['.git*', 'node_modules*','*.log','*.box','Vagrantfile']
config.trigger.after :up do |t|
t.info = "rsync auto"
t.run = {inline: "vagrant rsync-auto"}
# 若是想后台运行,则使用下面语句
# t.run = {inline: "bash -c 'vagrant rsync-auto &'"}
end
复制代码
参考 Vagrant Does not Start RSync-Auto on Up or Reload#briancain's replygit
经测试,在win10上,须要安装插件(vagrant-vbguest vagrant-winnfsd)github
vagrant plugin install vagrant-vbguest vagrant-winnfsd
复制代码
若是报windows
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
ERROR: SSL verification error at depth 3: unable to get local issuer certificate (20)
ERROR: You must add /C=US/O=Starfield Technologies, Inc./OU=Starfield Class 2 Certification Authority to your local trusted store
Vagrant failed to load a configured plugin source. This can be caused
by a variety of issues including: transient connectivity issues, proxy
filtering rejecting access to a configured plugin source, or a configured
plugin source not responding correctly. Please review the error message
below to help resolve the issue:
SSL_connect returned=1 errno=0 state=error: certificate verify failed (https://gems.hashicorp.com/specs.4.8.gz)
Source: https://gems.hashicorp.com/
复制代码
须要设置CAfilebash
set SSL_CERT_FILE="path\to\Vagrant\embedded\cacert.pem"
复制代码
若是下载速度慢,而且有境外代理服务器,能够考虑设置代理服务器
set http_proxy=http://username:password@ip:port
set https_proxy=http://username:password@ip:port
复制代码
设置Vagrantfilepost
# ... 忽略无关内容
config.vm.synced_folder ".", "/vagrant",
type:"nfs"
# ... 忽略无关内容
复制代码