1、首先安装依赖包(各个节点都要安装)
[[email protected] ~]$ yum install gcc-gfortran #否则报”configure: error: No F77 compiler found”错误 [root@Hadoop-NN-01 ~]$ yum install gcc gcc-c++ #否则报”configure: error: C++ preprocessor “/lib/cpp” fails sanity check”错误 [root@Hadoop-NN-01 ~]$ yum install readline-devel #否则报”–with-readline=yes (default) and headers/libs are not available”错误 [root@Hadoop-NN-01 ~]$ yum install libXt-devel #否则报”configure: error: –with-x=yes (default) and X11 headers/libs are not available”错误
2、下载RHadoop相关软件包
R-3.2.5.tar.gz #https://cran.rstudio.com/src/base/R-3/ rmr-3.3.1 #https://github.com/RevolutionAnalytics/rmr2 rhdfs-1.0.8 rhbase-1.2.1 #以上软件下载地址:https://github.com/RevolutionAnalytics/RHadoop/wiki/Downloads rJava reshape2 Rcpp iterators itertools digest RJSONIO functional bitops stringr plyr caTools Rserve #以上软件下载地址:http://cran.at.r-project.org/src/contrib/Archive/ RStudio #https://www.rstudio.com/products/rstudio/download/ Thrift #https://thrift.apache.org/
3、安装R语言(各个节点都要安装)
[[email protected] mysofts]# tar zxf /mnt/mydisk/soft/R/R-3.2.5.tar.gz [[email protected] mysofts]# cd R-3.2.5 [[email protected] R-3.2.5]# ./configure --enable-R-shlib [[email protected] R-3.2.5]# make [[email protected] R-3.2.5]# make install
其中readline-devel、libXt-devel在编译R的时候需要,而--enable-R-shlib是安装R的共享库,在安装Rstudio需要。
4、确认Java环境变量
RHadoop依赖于rJava包,安装rJava前确认已经配置了Java环境变量,然后进行R对jvm建立连接。
[email protected] ~]# R CMD javareconf
5、安装相关的依赖包,确保RHadoop软件包能正常使用
[[email protected] ~]# R > install.packages("rJava") > install.packages("reshape2") > install.packages("Rcpp") > install.packages("iterators") > install.packages("itertools") > install.packages("digest") > install.packages("RJSONIO") > install.packages("functional") > install.packages("bitops") > quit()
或者使用软件包安装:
[[email protected] mysofts]# R CMD INSTALL rJava_0.9-8.tar.gz [[email protected] mysofts]# R CMD INSTALL Rcpp_0.12.3.tar.gz [[email protected] mysofts]# R CMD INSTALL plyr_1.8.1.tar.gz [[email protected] mysofts]# R CMD INSTALL stringr_0.6.tar.gz [[email protected] mysofts]# R CMD INSTALL reshape2_1.4.tar.gz [[email protected] mysofts]# R CMD INSTALL iterators_1.0.7.tar.gz [[email protected] mysofts]# R CMD INSTALL itertools_0.1-1.tar.gz [[email protected] mysofts]# R CMD INSTALL digest_0.6.8.tar.gz [[email protected] mysofts]# R CMD INSTALL RJSONIO_1.2-0.2.tar.gz [[email protected] mysofts]# R CMD INSTALL functional_0.4.tar.gz [[email protected] mysofts]# R CMD INSTALL bitops_1.0-5.tar.gz [[email protected] mysofts]# R CMD INSTALL caTools_1.17.tar.gz
6、安装RHadoop软件包
首先将下面的变量加入到环境变量中:
[[email protected] ~]# vi /etc/profile export HADOOP_CMD=/home/hadoopuser/hadoop-2.6.0-cdh5.6.0/bin/hadoop export HADOOP_STREAMING=/home/hadoopuser/hadoop-2.6.0-cdh5.6.0/share/hadoop/tools/lib/hadoop-streaming-2.6.0-cdh5.6.0.jar [root@Hadoop-NN-01 ~]# source /etc/profile #保存生效
安装
[[email protected] mysofts]# R CMD INSTALL rhdfs_1.0.8.tar.gz [[email protected] mysofts]# R CMD INSTALL rmr2_3.3.0.tar.gz #各个节点都要安装
7、使用RHadoop软件包
[[email protected] ~]# R > library(rhdfs) > hdfs.init() > hdfs.ls("/")
8、安装Rstudio
[[email protected] mysofts]# tar xzvf rstudio-0.99.896-x86_64-fedora.tar.gz #解压即用
9、TIPS
A:R相关的软件包安装在/usr/local/lib64/R/library下,可以在该目录下查看是否已经安装了相应的软件包。
B:如果安装的时候不是用root身份安装,则R安装的软件包会在用户目录上,其他用户将使用不了软件包。
C:在安装rhbase软件需要安装thrift,在后面章节介绍。
时间: 2024-10-18 07:50:19