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
-
installing to /usr/local/lib64/R/library/Cairo/libs
-
** R
-
** preparing package for lazy loading
-
** help
-
*** installing help indices
-
** building package indices
-
** testing if installed package can be loaded
-
* DONE (Cairo)
3、
安装 FastRWeb
# R CMD INSTALL FastRWeb_1.1-0.tar.gz
-
touch null.so null.dll # to make R CMD SHLIB happy
-
installing to /usr/local/lib64/R/library/FastRWeb/libs
-
** R
-
** inst
-
** preparing package for lazy loading
-
** help
-
*** installing help indices
-
** building package indices
-
** testing if installed package can be loaded
-
* DONE (FastRWeb)
4、
安装Rserve
# R CMD INSTALL Rserve_1.7-3.tar.gz
-
installing via 'install.libs.R' to /usr/local/lib64/R/library/Rserve
-
** R
-
** inst
-
** preparing package for lazy loading
-
** help
-
*** installing help indices
-
** building package indices
-
** testing if installed package can be loaded
-
* 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
-
http.port 80
-
remote enable
-
source /var/FastRWeb/code/rserve.R
-
control enable
2)配置 rserve.R
cp rserve.R rserve.Rbak
vim rserve.R(在文件上的最上面增加2行代码)
-
library(FastRWeb)
-
.http.request <- FastRWeb:::.http.request
7、启动 FastRWeb
./start
-
Starting Rserve on slave1
-
Loading packages...
-
XML: FALSE
-
Cairo: TRUE
-
Matrix: TRUE
-
FastRWeb: TRUE
-
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
-
# create an image
-
# 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
-
run <- function(...) {
-
p <- WebPlot(600, 600)
-
plot(rnorm(100), rnorm(100), pch = 19, col = 2)
-
p
-
}
阅读(6697) | 评论(0) | 转发(0) |