docker安装rstudios
docker安装rstudios
docker exec --privileged -u root -it 容器id sh 以管理员方式访问容器
1、docker run -d -p 8787:8787 -p 6311:6311 quantumobject/docker-rstudio
2、docker exec -it container-id /bin/bash
adduser mwlr1234
passwd 1234
mkdir /home/mwlr
chmod -R 777 /home/mwlr1234
sudo apt-get install default-jdk
vi /etc/profile
export JAVA_HOME=/usr/lib/jvm/default-java
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
3、登陆网址+端口号8787
install.packages(rJava)
install.packages(Rserve)
library(rJava)
library(Rserve)
4、rserve启动远程服务。默认rserve 未启动远程调用
#加载Rserver
> library("Rserve", lib.loc="~/R/x86_64-pc-linux-gnu-library/3.4")
#设置工作目录
> setwd("/R")
启动Rserver,web模式会错误
> Rserve()
启动Rserver,web模式使用
> Rserve(args='--no-save')
Rserve(args="--no-save") rstudio中启动rserve服务 cmd模式可以不要参数
- Rserv.conf: 配置文件
- source.R:初始化脚步文件
查看当前的Rserve 服务器的默认配置信息
- ~ R CMD Rserve --RS-settings
- Rserve v1.7-1
- config file: /etc/Rserv.conf
- working root: /tmp/Rserv
- port: 6311
- local socket: [none, TCP/IP used]
- authorization required: no
- plain text password: not allowed
- passwords file: [none]
- allow I/O: yes
- allow remote access: no
- control commands: no
- interactive: yes
- max.input buffer size: 262144 kB
- config file: 我本地无此文件/etc/Rserv.conf, 系统会默认跳过这项
- working root: R运行时工作目录 /tmp/Rserv
- port: 通信端口6311
- local socket: TCP/IP协议
- authorization: 认证未开启
- plain text password: 不允许明文密码
- passwords file: 密码文件,未指定
- allow I/O: 允许IO操作
- allow remote access: 远程访问未开启
- control commands: 命令控制未开启
- interactive: 允许通信
- max.input buffer size: 文件上传限制262mb
修改默认配置,新建文件:/etc/Rserv.conf
- ~ sudo vi /etc/Rserv.conf
- workdir /tmp/Rserv
- remote enable
- fileio enable
- interactive yes
- port 6311
- maxinbuf 262144
- encoding utf8
- control enable
- source /home/conan/R/RServe/source.R
- eval xx=1
- ~ vi /home/conan/R/RServe/source.R
- cat("This is my Rserve!!")
- print(paste("Server start at",Sys.time()))
再次查看服务器配置
- R CMD Rserve --RS-settings
- Rserve v1.7-1
- config file: /etc/Rserv.conf
- working root: /tmp/Rserv
- port: 6311
- local socket: [none, TCP/IP used]
- authorization required: yes
- plain text password: allowed
- passwords file: [none]
- allow I/O: yes
- allow remote access: yes
- control commands: yes
- interactive: yes
- max.input buffer size: 262144 kB
- 允许远程访问
- 需要登陆认证
- 允许明文密码