云服务器linux(centos)系统下Rstudio的下载及连接R语言软件
云服务器linux(centos)系统下Rstudio的下载及连接R语言软件
前提为在云服务器端打开Rstudio8787的端口
1 进入Rstudio官网找到对应系统的Rstudio的rpm文件用wget下载RStudio Server - Posit好吧Rstudio官网改成Posit了哎。选择自己需要的版本这里我选择了centos7
wget https://download2.rstudio.org/server/centos7/x86_64/rstudio-server-rhel-2022.07.2-576-x86_64.rpm
yum install rstudio-server-rhel-2022.07.2-576-x86_64.rpm
或者rpm -ivh rstudio-server-rhel-2022.07.2-576-x86_64.rpm
2 搜寻一下R的安装位置 which R 我这里为/usr/bin/R/bin/R
配置Rstudio的环境变量echo "rsession-which-r=/usr/bin/R/bin/R" >> /etc/rstudio/rserver.conf
或者vim /etc/rstudio/rserver.conf 写入rsession-which-r=/usr/bin/R/bin/R 两者是一样的效果
3为Rstudio创建用户名及密码 adduser shiny 设置shiny为用户名
passwd shiny 为shiny设置密码 这里自己设置密码 密码需要输入一次回车,再重复输入一次回车然后确定即可。
4 systemctl start rstudio-server.service 开启Rstudio
systemctl restart rstudio-server.service重启Rstudio
systemctl status rstudio-server.service 查看Rstudio的运行状态(绿色的running即为正在运行中可以进行web端口访问)
systemctl stop rstudio-server.service 停止运行Rstudio
5 进入web进入Rstudio,在网址栏输入云服务器公网ip:8787 然后输入自己设置的用户名及密码即可进入Rstudio进行代码编写即可。
注:Rstudio导入R包时会缺失各种依赖,只需要按要求从终端加载依赖即可。有些依赖yum加载不了,需要从网页上找到其rpm文件进行rpm -ivh xxxx.rpm xxxx为缺失的依赖,这里注意xxxx有时可能与Rstudio提示的名字略有不同,因为Rstudio需求的rpm之内。要根据实际情况进行自我判断。
更多推荐
所有评论(0)