Chef :: Exceptions :: ChecksumMismatch从源码安装nginx-1.7.8

运行vagrant up --provision时出现以下错误 – 设置我的开发环境与vagrant …

 ==> default: [2014-12-08T20:33:51+00:00] ERROR: remote_file[http://nginx.org/download/nginx-1.7.8.tar.gz] (nginx::source line 58) had an error: Chef::Exceptions::ChecksumMismatch: Checksum on resource (0510af) does not match checksum on content (12f75e) 

我的厨师JSON有以下nginx:

 "nginx": { "version": "1.7.8", "user": "deploy", "init_style": "init", "modules": [ "http_stub_status_module", "http_ssl_module", "http_gzip_static_module" ], "passenger": { "version": "4.0.53", "gem_binary": "/home/vagrant/.rbenv/shims/gem" }, "configure_flags": [ "--add-module=/home/vagrant/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/passenger-3.0.18/ext/nginx" ], "gzip_types": [ "text/plain", "text/html", "text/css", "text/xml", "text/javascript", "application/json", "application/x-javascript", "application/xml", "application/xml+rss" ]} 

Cheffile有以下的食谱:

 cookbook 'nginx' 

如何解决Checksum不匹配?

当使用另一个版本的nginx时, nginx食谱要求你编辑checksum属性。 导致您出错的remote_file资源是:

 remote_file nginx_url do source nginx_url checksum node['nginx']['source']['checksum'] path src_filepath backup false end 

您需要更新校验和值。 具体node['nginx']['source']['checksum']

所以在你的JSON中,你可以添加这一行:

 "source": {"checksum": "insert checksum here" } 

编辑 :正如在评论中指出的,校验和是SHA256。 您可以像这样生成文件的校验和:

 shasum -a 256 nginx-1.7.8.tar.gz