Ruby on rails 使用RVM安装Ruby 1.9.2时出现Curl证书错误

Ruby on rails 使用RVM安装Ruby 1.9.2时出现Curl证书错误,ruby-on-rails,curl,rvm,Ruby On Rails,Curl,Rvm,RVM在尝试下载Ruby 1.9.2时遇到证书错误。看起来像是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 ER

RVM在尝试下载Ruby 1.9.2时遇到证书错误。看起来像是
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.

如何解决或避免此错误?

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

#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
  • 从下载yaml-0.1.3.tar.gz
  • 将其保存到/Users/.rvm/archives/yaml-0.1.3.tar.gz
  • 运行以下命令:

    chmod 777 yaml-0.1.3.tar.gz

    tar zxf/Users/.rvm/archives/yaml-0.1.3.tar.gz-C/Users/.rvm/src

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

[2011-07-05 14:24:07]tar zxf/Users/.rvm/archives/yaml-0.1.3.tar.gz-C/Users/.rvm/src——没有相同的所有者 tar(子):/Users/.rvm/archives/yaml-0.1.3.tar.gz:无法打开:没有这样的文件或目录 tar(子级):错误不可恢复:正在退出 tar:返回的子项状态2 tar:由于以前的错误而延迟的错误退出


您需要从下载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

谢谢Dorothy-这个食谱对我有用,在Win7环境中做了以下小修改:

其他有此问题的人士——

  • 感谢关于更新CA_Bundle的讨论-很好 但这并没有帮助解决这个问题-Pyaml网站证书仍将继续使用 导致CURL抛出错误,因为CURL是在安装程序中启动的, 无法添加a-k选项

  • Ruby 1.9.2-p290正在尝试安装YAML 0.1.4,因此Google需要 镜像并下载该版本-YAML-0.1.3在中不起作用 绕过这些问题

  • 您需要在rvm/src中执行相当于CHMOD 777的windows操作 将文件夹添加到提取的文件中。更改安全性,以便每个人都有 所有权/所有权限,并关闭所有文件和的只读属性 文件夹


  • 安装程序在尝试下载时仍会抛出错误(CURL error),但会通过尝试提取来恢复。提取将抛出错误,因为tarball已提取到src文件夹。如果第3步中的权限设置正确,那么配置YAML的下一步应该可以正常工作,并且安装应该在没有进一步问题的情况下完成。(如果通过cygwin/bash安装,则需要添加一个C编译器,如“gcc”,并将“ncurses”(tput命令)和“make”添加到默认的核心cygwin安装选项中。)

    Curl在.rvm/scripts/fetch中调用,默认情况下,它将位于您的主目录中

    使用您喜爱的文本编辑器编辑此内容:例如

     nano ~/.rvm/scripts/fetch
    
    在第56行和第58行(当然,可能与RVM的其他版本不同)中,您将看到两行开头

     fetch_command="curl ...
    

    只需在curl之后添加-k,保存并重试。

    我试图安装ruby-1.9.2-p290,但遇到了相同的问题。在运行
    哪个curl
    并意识到curl实例来自我的系统(OS X Snow Leopard)上的MAMP安装之后,我重新配置了
    PATH
    变量,以使用
    /usr/bin/curl
    处的系统默认值。使用这个版本,
    curl 7.19.7
    ,我可以在Centos 5.6(最终版)上安装最新版本的Ruby with RVM 我在安装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
    

    顺便说一句,curl版本是curl 7.18.0(检查“$curl-V”)

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

    #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=
    

    如果其他人在尝试更新到1.9.3时遇到此问题(尽管版本可能不重要),请检查您拥有的rvm版本。韦恩似乎已经从rvm.beginrescueend.com转到rvm.io。旧站点的安全证书已过期,因此curl的响应是正确的

    从新站点更新rvm修复了此问题,并允许我继续前进

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

    更新:正如@rodgerdpack提到的,命令发生了变化,我已经更新了上面的内容。一般来说,请参阅以获取最新信息。

    也许所有这些复杂的解决方案曾经是必要的,但现在您需要做的只是首先升级RVM,您的问题将得到解决:

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

    如果您不介意禁用证书签入curl(我不介意):


    谢谢,你为我节省了一些时间!这本可以帮我在Open151上节省几个小时。如果我能多次投票,我会的。这在CentOS 5.8上对我很有效;证书位于/etc/pki/Certs/中,供需要在CentOS上查找的用户使用!您如何处理生成的curl ca bundle new.crt?新的证书文件应该存在于使用“curl config--ca”找到的目录中。您是否安装了所有以前的依赖项以编译该Ruby版本?整个问题和建议的解决方案在非常长的错误消息中陈述。我不认为在回答中重复这段文字会有很大帮助。开始阅读上面提到的URL。@daniel,除了让curl停止抱怨错误的SSL证书的正常方法,-k不能在这里使用,因为curl是由rvm驱动的。顺便说一句,您应该仔细考虑是否真的要允许curl忽略错误的SSL证书。你可以试着做一个卷发@多萝西下面的答案应该有用。@dan:所以请再看一遍错误消息。它并不是特别建议您忽略坏证书(我写了那个错误消息),它显然是
    $ 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