在Teradata Aster database 上离线安装R分析语言

来源:互联网 发布:手机制作软件 编辑:程序博客网 时间:2024/05/14 10:01

Install R on AD6.0 Without Internet Access

实验环境:
ENVIRONMENT
OS:AMOS SLES_11_SP2
DATABASE:AD 6.0


  1. 第一步:准备所需要的内容
    Prepare installation
    a,根据自己的系统下载相应的rpm包,如果是SlES从OpenSuse上下载基本安装包 http://download.opensuse.org/repositories/devel:/languages:/R:/released/SLE_11_SP2/x86_64/
    R-base-3.1.3-14.1.x86_64.rpm
    R-base-devel-3.1.3-14.1.x86_64.rpm
    b,准备好系统光盘 SLES-11-SP2-DVD-x86_64-GM-DVD1.iso or SLES_11_SP2_Aster_AD6.0.iso
    c,准备好SuSe的开发光盘,也可从网上获取,SLES-11-SP2-SDK-DVD-x86_64-GM-DVD1.iso
    d,依次挂上两上张光盘ISO
SLES-11-SP2-DVD-x86_64-GM-DVD1.iso  mount -o ro /dev/cdrom /var/opt/pubcp -rf /var/opt/pub/* /data/localrepo/suse11sp1umount /dev/cdromSLES-11-SP2-SDK-DVD-x86_64-GM-DVD1.iso  mount -o ro /dev/cdrom /var/opt/pubcp -rf /var/opt/pub/* /data/localrepo/suse11sp1sdkumount /dev/cdrom

2.第二步,创建安装源

Make sure you have zypper preinstalled. #确保你已经安装了zypperaster-queen:~ # zypper ar file:///data/localrepo/suse11sp1suse11sp1aster-queen:~ # zypper ar file:///data/localrepo/suse11sp1sdk/suse11sp1sdkaster-queen:~ # zypper ar file:///data/localrepo/rbaserbaseaster-queen:~ # zypper lr# | Alias | Name | Enabled | Refresh--+---------------------+---------------------------------------------------------+---------+--------1 | ncluster-custom | General purpose repo for hosting misc packages on Queen | No | No2 | ncluster-extra | Additional packages shipped by Aster | No | No3 | ncluster-queen-base | Base Mirror hosted on Queen | No | No4 | rbase | rbase | Yes | No5 | suse11sp1 | suse11sp1 | Yes | No6 | suse11sp1sdk | suse11sp1sdk | Yes | No#zypper clean#zypper ref###以下步骤为预先配置repo,但非必须,对于Aster来说,可以在安装的时候指定reop,见第三步,the step is not necessary#ncli apm administer R --setuprepo=suse11sp1,"file:/data/localrepo/suse11sp1"# ncli apm administer R --setuprepo=suse11sp1sdk,"file:/data/localrepo/suse11sp1sdk/"# ncli apm administer R --setuprepo=rbase,"file:/data/localrepo/rbase"

3 .第三步,安装R在主控节点Queen上
注意在安装时临时指定repo安装源时,需要指定usedefaultrrepo为false

aster-queen:/opt/aster/third-party # ncli apm install R --repo=suse11sp1,"file:/data/localrepo/suse11sp1" --repo=suse11sp1sdk,"file:/data/localrepo/suse11sp1sdk/" --repo=rbase,"file:/data/localrepo/rbase" --usedefaultrrepo=falsesuse11sp1 Repo created successfully.suse11sp1sdk Repo created successfully.rbase Repo created successfully.Starting APMInstalling package sles-releaseSuccessfully installed sles-release packageInstalling package makeSuccessfully installed make packageInstalling package gcc-fortranSuccessfully installed gcc-fortran packageInstalling package gcc-c++Successfully installed gcc-c++ packageInstalling package lessSuccessfully installed less packageInstalling package R-baseSuccessfully installed R-base packagePackage R-base-devel is already installedR installation is complete on the queen node. Before executing R, perform ncli system softrestart to complete R installation on the Aster Cluster.suse11sp1 Repo successfully removed.suse11sp1sdk Repo successfully removed.rbase Repo successfully removed.

如果显示以上信息表示安装成功,如果缺包,请在SDK上确保有,因为大部分是SDK去提供

同步安装到集群所有节点上
All R packages are installed in /opt/aster/third-party/R directory on all the cluster nodes.
NOTE: The ncli commands to install and uninstall the base/optional R packages can be run on queen node only as root.

# ncli system softrestart# ncli system activate --full

如果安装成功,你将看到类似的消息,

ster-queen:~ # ncli apm show R --infoR version 3.1.3 (2015-03-09) --"Smooth Sidewalk"Copyright (C) 2015 The R Foundation for Statistical ComputingPlatform: x86_64-suse-linux-gnu (64-bit)R is free software and comes with ABSOLUTELY NO WARRANTY.You are welcome to redistribute it under the terms of theGNU General Public License versions 2 or 3.For more information about these matters seehttp://www.gnu.org/licenses/.aster-queen:~ # ncli apm show R --packagesDefault R Packages found in LibPath /usr/lib64/R/library+------------+---------+-------------+| Package | Version | Priority |+------------+---------+-------------+| KernSmooth | 2.23-14 | recommended || MASS | 7.3-39 | recommended || Matrix | 1.1-5 | recommended || base | 3.1.3 | base || boot | 1.3-15 | recommended || class | 7.3-12 | recommended |Install R on AD6.0 Without Internet AccessR Page 1| class | 7.3-12 | recommended || cluster | 2.0.1 | recommended || codetools | 0.2-10 | recommended || compiler | 3.1.3 | base || datasets | 3.1.3 | base || foreign | 0.8-63 | recommended || grDevices | 3.1.3 | base || graphics | 3.1.3 | base || grid | 3.1.3 | base || lattice | 0.20-30 | recommended || methods | 3.1.3 | base || mgcv | 1.8-4 | recommended || nlme | 3.1-120 | recommended || nnet | 7.3-9 | recommended || parallel | 3.1.3 | base || rpart | 4.1-9 | recommended || spatial | 7.3-9 | recommended || splines | 3.1.3 | base || stats | 3.1.3 | base || stats4 | 3.1.3 | base || survival | 2.38-1 | recommended || tcltk | 3.1.3 | base || tools | 3.1.3 | base || utils | 3.1.3 | base |+------------+---------+-------------+
  1. 第四步,验证安装
    Verify installation and Running R script on Aster
    先创建一个R测试文件
    Install a sample R script:
    On the queen node, create a file named rexe.R under the /tmp directory that contains this R script
IN = file(description="stdin",open="r")while(1){# Create a frame to hold the input rows, without HEADER,# and also to deal with end of stream# read.table() is called inside the try block to detect when the# program reaches the end of rows.frame<-try(read.table(IN,header=FALSE,sep="\t",quote="",nrows=1),silent=TRUE)if(inherits(frame,"try-error"))breakwrite.table(frame,stdout(),col.names=FALSE,row.names=FALSE,quote=FALSE,sep="\t")}

在Aster 上安装这个R文件
Connect to the Aster Database, using the Aster Database Cluster Terminal (ACT) from the /tmp directory, and issue this command to install file.R:

beehive=>\install file.R

Aster 上创建表,并写测试数据,并通过 Aster的SQL-MR函数stream去调用R读取数据,一个简单的例子就实行了.
Using ACT, connect to the Aster Database and issue these SQL statements:

create table mytable(a int) distribute by hash(a);insert into mytable values (1000);insert into mytable values (100);beehive=> SELECT * FROM stream(ON mytable SCRIPT('Rexec --vanilla rexe.R') OUTPUTS('*'));a------1001000(2 rows)beehive=>

至此,你的Aster 集群就可以运行R语言了.

总结:
通过在Aster 集群Queen上安装R语言,本次只安装了基础包,但Aster提供第三方包管理器,方便你安装的R的扩展包(ncli apm install R –package),Aster会同步你的安装到集群上.在Redhat上的方法类似.

1 0
原创粉丝点击