异常信息:

  1. > install.packages("rms")
  2. --- Please select a CRAN mirror for use in this session ---
  3. Warning: failed to download mirrors file (cannot open URL 'https://cran.r-project.org/CRAN_mirrors.csv'); using local file '/Bioinfo/Pipeline/SoftWare/R/R-3.6.1/lib64/R/doc/CRAN_mirrors.csv'
  4. trying URL 'http://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/rms_6.0-0.tar.gz'
  5. Content type 'application/x-gzip' length 623859 bytes (609 KB)
  6. ==================================================
  7. downloaded 609 KB
  8. ......
  9. * DONE (rms)
  10. The downloaded source packages are in
  11. ‘/tmp/RtmpJF5nYY/downloaded_packages
  12. Updating HTML index of packages in '.Library'
  13. Making 'packages.html' ... done
  14. Warning message:
  15. In download.file(url, destfile = f, quiet = TRUE) :
  16. URL 'https://cran.r-project.org/CRAN_mirrors.csv': status was 'SSL connect error'
  17. >

参考方法:

  • 先设置镜像,再执行包安装。

    1. # CRAN 镜像源配置文件之一是 .Rprofile (linux 下位于 ~/.Rprofile ),可以在文末添加如下语句:
    2. options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
  • 也有可能是由于 CentOS 6.x 自带的 OpenSSL(最高版本是 openssl-1.0.1e-15.el6.x86_64)引发的一个 bug,如果是这种情况,请参考这篇文章解决。

服务器关于 OpenSSL/SSL 的异常处理备忘

参考资料

  1. Tuna,CRAN 镜像使用帮助清华大学开源软件镜像站
  2. rstudio,Secure Package Downloads for RRStudio Suppor