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

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/pub
cp -rf /var/opt/pub/* /data/localrepo/suse11sp1
umount /dev/cdrom
SLES-11-SP2-SDK-DVD-x86_64-GM-DVD1.iso  mount -o ro /dev/cdrom /var/opt/pub
cp -rf /var/opt/pub/* /data/localrepo/suse11sp1sdk
umount /dev/cdrom

2.第二步,创建安装源

Make sure you have zypper preinstalled. #确保你已经安装了zypper
aster-queen:~ # zypper ar file:///data/localrepo/suse11sp1suse11sp1
aster-queen:~ # zypper ar file:///data/localrepo/suse11sp1sdk/suse11sp1sdk
aster-queen:~ # zypper ar file:///data/localrepo/rbaserbase
aster-queen:~ # zypper lr
# | Alias | Name | Enabled | Refresh
--+---------------------+---------------------------------------------------------+---------+--------
1 | ncluster-custom | General purpose repo for hosting misc packages on Queen | No | No
2 | ncluster-extra | Additional packages shipped by Aster | No | No
3 | ncluster-queen-base | Base Mirror hosted on Queen | No | No
4 | rbase | rbase | Yes | No
5 | suse11sp1 | suse11sp1 | Yes | No
6 | 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=false
suse11sp1 Repo created successfully.
suse11sp1sdk Repo created successfully.
rbase Repo created successfully.
Starting APM
Installing package sles-release
Successfully installed sles-release package
Installing package make
Successfully installed make package
Installing package gcc-fortran
Successfully installed gcc-fortran package
Installing package gcc-c++
Successfully installed gcc-c++ package
Installing package less
Successfully installed less package
Installing package R-base
Successfully installed R-base package
Package R-base-devel is already installed
R 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 --info
R version 3.1.3 (2015-03-09) --"Smooth Sidewalk"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: 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 the
GNU General Public License versions 2 or 3.
For more information about these matters see
http://www.gnu.org/licenses/.
aster-queen:~ # ncli apm show R --packages
Default 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 Access
R 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"))
break
write.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
------
100
1000
(2 rows)
beehive=>

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

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

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值