使用RVM安装Ruby 1.9.2时出现卷曲证书错误

时间:2011-06-20 16:09:42

标签: ruby-on-rails curl rvm

尝试下载Ruby 1.9.2时,RVM遇到证书错误。看起来curl有证书问题,但我不确定如何绕过它。我在下面列出了确切的错误信息。

$ rvm install 1.9.2
Installing Ruby from source to: /Users/willdennis/.rvm/rubies/ruby-1.9.2-p180, this may take a while depending on your cpu(s)...

ruby-1.9.2-p180 - #fetching 
ERROR: Error running 'bunzip2 '/Users/willdennis/.rvm/archives/ruby-1.9.2-p180.tar.bz2'', please read /Users/willdennis/.rvm/log/ruby-1.9.2-p180/extract.log
ruby-1.9.2-p180 - #extracting ruby-1.9.2-p180 to /Users/willdennis/.rvm/src/ruby-1.9.2-p180
ruby-1.9.2-p180 - #extracted to /Users/willdennis/.rvm/src/ruby-1.9.2-p180
Fetching yaml-0.1.3.tar.gz to /Users/willdennis/.rvm/archives

curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). The default
 bundle is named curl-ca-bundle.crt; you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
ERROR: There was an error, please check /Users/willdennis/.rvm/log/ruby-1.9.2-p180/*.log. Next we'll try to fetch via http.
Trying http:// URL instead.

curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). The default
 bundle is named curl-ca-bundle.crt; you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
ERROR: There was an error, please check /Users/willdennis/.rvm/log/ruby-1.9.2-p180/*.log
Extracting yaml-0.1.3.tar.gz to /Users/willdennis/.rvm/src
ERROR: Error running 'tar zxf /Users/willdennis/.rvm/archives/yaml-0.1.3.tar.gz -C /Users/willdennis/.rvm/src --no-same-owner', please read /Users/willdennis/.rvm/log/ruby-1.9.2-p180/yaml/extract.log
/Users/willdennis/.rvm/scripts/functions/packages: line 55: cd: /Users/willdennis/.rvm/src/yaml-0.1.3: No such file or directory
Configuring yaml in /Users/willdennis/.rvm/src/yaml-0.1.3.
ERROR: Error running ' ./configure --prefix="/Users/willdennis/.rvm/usr"  ', please read /Users/willdennis/.rvm/log/ruby-1.9.2-p180/yaml/configure.log
Compiling yaml in /Users/willdennis/.rvm/src/yaml-0.1.3.
ERROR: Error running '/usr/bin/make ', please read /Users/willdennis/.rvm/log/ruby-1.9.2-p180/yaml/make.log
Installing yaml to /Users/willdennis/.rvm/usr
ERROR: Error running '/usr/bin/make install', please read /Users/willdennis/.rvm/log/ruby-1.9.2-p180/yaml/make.install.log
ruby-1.9.2-p180 - #configuring 
ERROR: Error running ' ./configure --prefix=/Users/willdennis/.rvm/rubies/ruby-1.9.2-p180 --enable-shared --disable-install-doc --with-libyaml-dir=/Users/willdennis/.rvm/usr ', please read /Users/willdennis/.rvm/log/ruby-1.9.2-p180/configure.log
ERROR: There has been an error while running configure. Halting the installation.

如何解决或避免此错误?

11 个答案:

答案 0 :(得分:125)

如果在尝试更新到1.9.3时遇到任何其他人(尽管版本可能无关紧要),请检查您拥有的rvm版本。 Wayne似乎从rvm.beginrescueend.com搬到了rvm.io.旧网站的安全证书已过期,因此curl的回复是正确的。

从新网站更新rvm解决了这个问题并允许我继续前进。

$ \curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled

更新:正如@rodgerdpack所提到的,命令会发生变化,我已经更新了上述内容。一般情况下,请参阅https://rvm.io/了解最新信息。

答案 1 :(得分:40)

如果不想更改脚本并且您不想将“永远”的证书添加到证书包中。有一个非常好的快速解决方案:

#to download the cert
wget http://curl.haxx.se/ca/cacert.pem
#to let curl use it for the next calls
export CURL_CA_BUNDLE=~/cacert.pem

然后运行你的脚本。 要重置环境变量(对于不应使用此证书的后续脚本调用),请重新登录系统或取消设置环境变量:

export CURL_CA_BUNDLE=

答案 2 :(得分:21)

在.rvm / scripts / fetch中调用Curl,默认情况下会在您的主目录中。

使用您喜欢的文本编辑器进行编辑:例如,

 nano ~/.rvm/scripts/fetch

在第56和58行(当然可能与其他版本的RVM不同),你会看到两行开始

 fetch_command="curl ...

只需在卷曲后添加-k,保存并重试。

答案 3 :(得分:20)

您需要从http://curl.haxx.se/ca/cacert.pem下载ca证书并将其添加到curl-ca-bundle-new.crt文件中。

要查找此文件的位置,请使用:

   $ curl-config --ca

   /usr/share/curl/curl-ca-bundle.crt

备份你的curl-ca-bundle.crt文件:

$ cp /usr/share/curl/curl-ca-bundle.crt /usr/share/curl/curl-ca-bundle.crt.old

然后你想使用以下方法连接这两个文件:

$ cat cacert.pem /usr/share/curl/curl-ca-bundle.crt >> curl-ca-bundle-new.crt

答案 4 :(得分:17)

也许所有这些复杂的解决方案都是必要的,但现在你需要做的就是首先升级RVM,你的问题就会解决:

$ rvm get stable
$ rvm reload
$ rvm install ruby-1.9.3-p194

答案 5 :(得分:14)

如果您不介意在curl中禁用证书检查(我没有):

echo insecure > ~/.curlrc

答案 6 :(得分:11)

On Centos 5.6(最终版) 我在安装rvm 1.9.2时遇到了问题 错误是:

curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). The default
 bundle is named curl-ca-bundle.crt; you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
ERROR: There was an error, please check /usr/local/rvm/log/ruby-1.9.2-p290/*.log. Next we'll try to fetch via http.
Trying http:// URL instead.

curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). The default
 bundle is named curl-ca-bundle.crt; you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
ERROR: There was an error, please check /usr/local/rvm/log/ruby-1.9.2-p290/*.log
ERROR: There has been an error while trying to fetch the source.  
Halting the installation.
ERROR: There has been an error fetching the ruby interpreter. Halting the installation.

以下列出了帮助我解决问题的行动

$ curl-config --ca # show path to the certificate
/usr/local/share/curl/curl-ca-bundle.crt
$ cd /usr/local/share/curl/ # go to that path
$ cp curl-ca-bundle.crt curl-ca-bundle.crt.bak # backup certificate
$ curl http://curl.haxx.se/ca/cacert.pem -o curl-ca-bundle.crt # download new
$ rvm install 1.9.2 # bingo it works

Btw curl版本是卷曲7.18.0(检查'$ curl -V')

答案 7 :(得分:3)

我试图安装ruby-1.9.2-p290并遇到同样的问题。运行which curl并意识到curl实例来自我的系统(OS X Snow Leopard)上的MAMP安装后,我重新配置了PATH变量以使用/usr/bin/curl处的系统默认值。使用此版本curl 7.19.7,我可以使用RVM安装最新版本的Ruby。

答案 8 :(得分:2)

我在使用RVM安装1.9.2时遇到问题,这是我的解决方案:

我仍然找不到文件错误,但安装继续成功

  

[2011-07-05 14:24:07] tar zxf /Users//.rvm/archives/yaml-0.1.3.tar.gz -C /Users//.rvm/src --no-same -所有者   tar(孩子):/Users//.rvm/archives/yaml-0.1.3.tar.gz:无法打开:没有这样的文件或目录   tar(child):错误无法恢复:现在退出   tar:孩子返回状态2   tar:从先前错误延迟的错误退出

答案 9 :(得分:1)

谢谢Dorothy - 这个配方对我有用,对Win7环境进行了以下小修改:

对于有此问题的其他人 -

  1. 感谢有关更新CA_Bundle的讨论 - 很有必要 但它没有帮助解决这个问题 - pyyaml网站证书仍然存在 导致CURL抛出错误,因为CURL在安装程序中启动, 无法添加-k选项。

  2. Ruby 1.9.2-p290正在尝试安装YAML 0.1.4,以便Google支持 镜像和下载该版本 - YAML-0.1.3将无效 绕过问题。

  3. 你需要在rvm / src中做相当于CHMOD 777的窗口 文件夹到解压缩的文件。改变安全性,以便每个人都有 所有权/所有权限并关闭所有文件的只读属性 文件夹。

  4. 安装程序在尝试下载(CURL错误)时仍会抛出错误,但会通过尝试解压缩而恢复。提取会抛出错误,因为tarball已经被解压缩到src文件夹中。如果正确设置了步骤3中的权限并且安装应该完成而没有其他问题,则配置YAML的下一步应该没有错误。 (如果通过cygwin / bash安装,则需要添加一个C编译器,如'gcc',并将'ncurses'(tput命令)和'make'添加到默认的核心cygwin设置选项中。)

答案 10 :(得分:0)

$ sudo apt-get install curl

$ curl -L https://get.rvm.io | bash -s stable --ruby   with ruby

$ curl -L https://get.rvm.io | bash -s stable --rails   with rails