Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2353539
  • 博文数量: 276
  • 博客积分: 5998
  • 博客等级: 大校
  • 技术积分: 5175
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-24 14:43
文章分类

全部博文(276)

文章存档

2014年(25)

2013年(11)

2012年(69)

2011年(167)

2010年(4)

分类: 大数据

2014-03-26 16:28:45

1、安装R 环境
  http://blog.chinaunix.net/uid-25135004-id-4173752.html
2、安装 cairo   
# R CMD INSTALL  cairo-1.12.14.tar.xz 
  1)报错
    Error in untar2(tarfile, files, list, exdir, restore_times) : 
    unsupported entry type ‘’
   解决方法:
    export R_INSTALL_TAR=tar

  2)报错
  configure: error: Cannot find cairo.h! Please install cairo () and/or set CAIRO_CFLA
  解决方法:
   yum install cairo-devel

点击(此处)折叠或打开

  1. installing to /usr/local/lib64/R/library/Cairo/libs
  2. ** R
  3. ** preparing package for lazy loading
  4. ** help
  5. *** installing help indices
  6. ** building package indices
  7. ** testing if installed package can be loaded
  8. * DONE (Cairo)

3、安装 FastRWeb 
# R CMD INSTALL FastRWeb_1.1-0.tar.gz 

点击(此处)折叠或打开

  1. touch null.so null.dll # to make R CMD SHLIB happy
  2. installing to /usr/local/lib64/R/library/FastRWeb/libs
  3. ** R
  4. ** inst
  5. ** preparing package for lazy loading
  6. ** help
  7. *** installing help indices
  8. ** building package indices
  9. ** testing if installed package can be loaded
  10. * DONE (FastRWeb)

4、安装Rserve  
# R CMD INSTALL Rserve_1.7-3.tar.gz 

点击(此处)折叠或打开

  1. installing via 'install.libs.R' to /usr/local/lib64/R/library/Rserve
  2. ** R
  3. ** inst
  4. ** preparing package for lazy loading
  5. ** help
  6. *** installing help indices
  7. ** building package indices
  8. ** testing if installed package can be loaded
  9. * DONE (Rserve)

5、初始化FastRWeb

 1)cd /usr/local/lib64/R/library/FastRWeb
 2)# sh install.sh 
  Done.
  Please check files in /var/FastRWeb/code
  If they match tour setup, you can start Rserve using
  /var/FastRWeb/code/start

6、配置FastRWeb 
cd /var/FastRWeb/code/
 1)配置rserve.conf
  cp rserve.conf rserve.confbak
  vi rserve.conf

点击(此处)折叠或打开

  1. http.port 80
  2. remote enable
  3. source /var/FastRWeb/code/rserve.R
  4. control enable
 2)配置 rserve.R
  cp rserve.R  rserve.Rbak
  vim rserve.R(在文件上的最上面增加2行代码)
  

点击(此处)折叠或打开

  1. library(FastRWeb)
  2. .http.request <- FastRWeb:::.http.request

7、启动 FastRWeb 
 ./start 

点击(此处)折叠或打开

  1. Starting Rserve on slave1
  2. Loading packages...
  3. XML: FALSE
  4. Cairo: TRUE
  5. Matrix: TRUE
  6. FastRWeb: TRUE
  7. Rserv started in daemon mode.
8、查看启动端口
# lsof -i:80
COMMAND  PID USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
Rserve  7564 root    4u  IPv4 3676662      0t0  TCP *:http (LISTEN)

9、访问
访问本机ip 





example1.png 相对应的代码  /var/FastRWeb/web.R/example1.png.R

点击(此处)折叠或打开

  1. # create an image
  2. # some browsers and/or web server are more happy if you call you script foo.png.R instead of foo.R so they can guess the MIME type from the name
  3. run <- function(...) {
  4.   p <- WebPlot(600, 600)
  5.   plot(rnorm(100), rnorm(100), pch = 19, col = 2)
  6.   p
  7. }





阅读(6728) | 评论(0) | 转发(0) |
0

上一篇:centos 6.3 R 安装

下一篇:Rhadoop安装

给主人留下些什么吧!~~