如何编译安装R-Project?

R Project

1 基础知识

R语言(r-project)是主要用于统计分析、绘图的语言和操作环境。

2 最佳实践

2.1 安装前的准备

2.1.1 安装编译工具

yum -y install gcc gcc-c++ make expat-devel

2.1.2 下载软件包

cd ~
wget https://cran.r-project.org/src/base/R-3/R-3.4.1.tar.gz

注意:其他版本请从以下目录下载,
https://cran.r-project.org/src/base/R-3/

2.1.3 解压软件包

cd ~
tar -xf R-3.4.1.tar.gz

2.2 编译安装

2.2.1 预编译软件

cd ~/R-3.4.1
./configure --bindir=/usr/bin/ \
            --sbindir=/usr/sbin/ \
            --libexecdir=/usr/libexec/ \
            --sysconfdir=/etc/ \
            --libdir=/usr/lib64/ \
            --includedir=/usr/include/ \
            --datarootdir=/usr/share/ \
            --infodir=/usr/share/info/ \
            --localedir=/usr/share/locale/ \
            --mandir=/usr/share/man/ \
            --docdir=/usr/share/doc/R/ \
            --with-x=no \
            --enable-R-shlib

参数“–with-x=no”是目的是避免以下错误,

configure: error: --with-x=yes (default) and X11 headers/libs are not available

如果遇到以下错误,

configure: error: --with-readline=yes (default) and headers/libs are not available

你可能需要安装如下包,

yum install -y readline-devel

如果遇到以下错误,

configure: error: cannot compile a simple Fortran program

你可能需要安装如下包,

yum install -y gcc-gfortran

如果遇到以下错误,

checking whether zlib support suffices... configure: error: zlib library and headers are required

你可能需要安装如下包,

yum install -y zlib-devel

如果遇到以下错误,

checking whether bzip2 support suffices... configure: error: bzip2 library and headers are required

你可能需要安装如下包,

yum install -y bzip2-devel

如果遇到以下错误,

configure: error: "liblzma library and headers are required"

你可能需要安装如下包,

yum install -y xz-devel

如果遇到以下错误,

checking whether PCRE support suffices... configure: error: pcre >= 8.20 library and headers are required

你可能需要安装如下包,

yum install -y pcre-devel

如果遇到以下错误,

configure: error: libcurl >= 7.22.0 library and headers are required with support for https

你可能需要安装如下包,

yum install -y libcurl-devel

2.2.2 编译软件

cd ~/R-3.4.1
make

如果遇到以下错误,

*** Cannot find any Java interpreter
*** Please make sure 'java' is on your PATH or set JAVA_HOME correspondingly

请按如下链接安装JDK(本章使用“jdk-8u121-linux-x64.tar.gz”),
https://www.cmdschool.org/archives/397

2.2.3 安装软件

cd ~/R-3.4.1
make install

如果遇到以下错误,

/usr/bin/install: cannot stat ‘NEWS.pdf’: No such file or directory

可使用如下命令解决,

cat doc/NEWS > doc/NEWS.pdf

2.2.4 确认软件安装成功

R --version

如果安装正常,你可见到如下输出,

R version 3.4.1 (2017-06-30) -- "Single Candle"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
http://www.gnu.org/licenses/.

2.3 软件包安装

关于R软件包的安装,可参阅以下专题,

如何管理R的软件包?

参阅文档
==================

GitHub首页
————-
https://www.r-project.org/

软件下载
————–
https://cran.r-project.org/src/base/R-3/
https://cran.r-project.org/mirrors.html

错误处理
—————–

https://stackoverflow.com/questions/17473547/error-with-readline-yes-default-and-headers-libs-are-not-available

没有评论

发表回复

R Project
如何安装部署Shiny-Server?

1 基础知识 2.1 R Markdown 2.1.1 R Markdown的简介 – …

R Project
如何安装配置RStudio Server?

1 基础知识 1.1 RStudio的介绍 RStudio是R编程语言集成开发环境(IDE) 1.2 …

R Project
如何管理R的软件包?

1 前言 R语言使用“base”与“utils”软件包实现管理,本章整理两个包的常用命令,以备使用。 …