从源代码安装 nginx-1.7.8 时 Chef::Exceptions::ChecksumMismatch [英] Chef::Exceptions::ChecksumMismatch when installing nginx-1.7.8 from source

查看:24
本文介绍了从源代码安装 nginx-1.7.8 时 Chef::Exceptions::ChecksumMismatch的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行 vagrant up --provision 来设置我的开发环境时出现以下错误...

I get the following error when running vagrant up --provision to set up my development environment with 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 有以下内容:

My chef JSON has the following for 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 有以下食谱:

and Cheffile has the following cookbook:

cookbook 'nginx'

如何解决校验和不匹配问题?

How do I resolve the Checksum mismatch?

推荐答案

nginx cookbook 需要你编辑 checksum 属性.导致您出错的 remote_file 资源是:

The nginx cookbook requires you to edit the checksum attribute when using another version of nginx. The remote_file resource that is causing you an error is:

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

您需要更新校验和值.特别是 node['nginx']['source']['checksum'].

You need to update the checksum value. Specifically node['nginx']['source']['checksum'].

所以在您的 JSON 中,您将添加以下行:

So in your JSON, you would add this line:

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

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

Edit: As pointed out in the comments, the checksum is SHA256. You can generate the checksum of the file like so:

shasum -a 256 nginx-1.7.8.tar.gz

这篇关于从源代码安装 nginx-1.7.8 时 Chef::Exceptions::ChecksumMismatch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆