首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何选择R服务器的R作为默认操作,远程R工作区和RStudio服务器?

如何选择R服务器的R作为默认操作,远程R工作区和RStudio服务器?
EN

Stack Overflow用户
提问于 2018-01-27 21:02:33
回答 1查看 282关注 0票数 2

因此,我在Linux (Ubuntu)上建立了一个Azure数据科学虚拟机(Ubuntu),并在终端上执行了以下操作,以支持远程R工作区、RStudio服务器、RStudio操作和hadoop:

代码语言:javascript
复制
sudo apt update
sudo apt -y upgrade

# Hadoop is installed but doesn't seem to appear on the PATH or have its environment variable set by default
sudo echo "" >> ~/.bashrc
sudo echo "export PATH="'$'"PATH:/opt/hadoop/hadoop-2.7.4/bin" >> ~/.bashrc
sudo echo "export HADOOP_HOME=/opt/hadoop/hadoop-2.7.4" >> ~/.bashrc
#
source ~/.bashrc

#Setting up a password as none exists to begin with because of private key selection in the installation
#RStudio Server requires a password though
"MyPassword\nMyPassword\n" | sudo passwd sshuser

#Unfortunately hadoop fails on Data Science Virtual Machine
#error: mkdir: Call From IM-DSonUbuntu/192.168.5.4 to localhost:9000 failed on connection exception: java.net.ConnectException: Connection refused; For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused
# hadoop fs -mkdir /user/RevoShare/rserve2
# hadoop fs -chmod uog+rwx /user/RevoShare/rserve2
sudo mkdir -p /var/RevoShare/rserve2
sudo chmod uog+rwx /var/RevoShare/rserve2
# hadoop fs -mkdir /user/RevoShare/sshuser
# hadoop fs -chmod uog+rwx /user/RevoShare/sshuser
sudo mkdir -p /var/RevoShare/sshuser
sudo chmod uog+rwx /var/RevoShare/sshuser

#Setting up R Server Operationalisation
cd /opt/microsoft/mlserver/9.2.1/o16n
sudo dotnet Microsoft.MLServer.Utils.AdminUtil/Microsoft.MLServer.Utils.AdminUtil.dll -silentoneboxinstall MyPassword


#They say this Data Science Virtual Machine already has RStudio Server, but even though the port 8787 is open, it's nowhere to be found! So installing it now, and after the installation it's accessible by refreshing the page that failed before.
#Perhaps it's not installed then? Or a service is not running like it shoudl?
#https://www.rstudio.com/products/rstudio/download-server/
wget https://download2.rstudio.org/rstudio-server-1.1.414-amd64.deb
yes | sudo gdebi rstudio-server-1.1.414-amd64.deb
#They are small, leave them for debug reasons - lets have evidence the script run thus far.
#sudo rm rstudio-server-1.1.414-amd64.deb

# Remote R workspace Service needs dotnet sdk
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt update
sudo apt -y install dotnet-sdk-2.0.0
sudo apt install libxml2-dev

#Downloading and installing the Remote R service
wget -O rtvs-daemon.tar.gz https://aka.ms/r-remote-services-linux-binary-current
tar -xvzf rtvs-daemon.tar.gz
sudo ./rtvs-install -s
sudo systemctl enable rtvsd
sudo systemctl start rtvsd
#sudo rm rtvs-daemon.tar.gz
#sudo rm rtvs-install

#Fixing Remote R: For some reason, even though 'sudo systemctl enable rtvsd' runs, after every reboot the service won't become automatically active. So let's fix that.
wget https://sa0im0general.blob.core.windows.net/general-blob-container/StartRemoteRAfterReboot.sh
sudo mv StartRemoteRAfterReboot.sh /var/RevoShare/StartRemoteRAfterReboot.sh

sudo /sbin/shutdown -r 5

sudo chown root /etc/rc.local
sudo chmod 755 /etc/rc.local
sudo systemctl enable rc-local.service
sudo -s
sudo find /etc/ -name "rc.local" -exec sed -i 's/exit 0//g' {} \;
sudo echo "" >> /etc/rc.local
sudo echo "sh /var/RevoShare/StartRemoteRAfterReboot.sh" >> /etc/rc.local
sudo echo "exit 0" >> /etc/rc.local
exit

我还一个接一个地尝试了这些,看看它是否对RStudio服务器产生了任何影响(它没有,但即使这样,我也想要一个全局解决方案,用于远程Remote服务和Service操作,而不仅仅是RStudio服务器):

代码语言:javascript
复制
#Configuring RStudio Server to see the R Server R
sudo echo "rsession-which-r=/opt/microsoft/mlserver/9.2.1/bin/R/R" >> /etc/rstudio/rserver.conf

export RSTUDIO_WHICH_R=/opt/microsoft/mlserver/9.2.1/bin/R/R
sudo echo "RSTUDIO_WHICH_R=/opt/microsoft/mlserver/9.2.1/bin/R/R" >> ~/.profile
source ~/.profile
sudo echo "RSTUDIO_WHICH_R=/opt/microsoft/mlserver/9.2.1/bin/R/R" >> ~/.bashrc
source ~/.bashrc

sudo echo "PATH=$PATH:/opt/microsoft/mlserver/9.2.1/bin/R" >> ~/.bashrc
export PATH=$PATH:/opt/microsoft/mlserver/9.2.1/bin/R
source ~/.bashrc

问题是,即使“哪个R”指向R Server的R,即输入"sudo R“将显示”加载Microsoft服务器包,版本9.2.1“的消息。并且会加载像RevoScaleR这样的包,其他的东西都做不到。

  1. 使用RStudio访问http://THE-IP-GOES-HERE.westeurope.cloudapp.azure.com:8787服务器并与初始用户("sshuser")登录(或与任何其他用户进行登录)将不会加载sshuser和RevoScaleR rx函数
  2. 使用本地Visual 2017通过“工作区”选项卡上的"Add connection“访问远程工作区,加载MRO,并指出:

已安装R版本:

代码语言:javascript
复制
    [0] Microsoft R Open '3.4.1.1347' (Default)
  1. 最后,当我使用rxSummary的操作并登录到"mrsdeploy“包的"remoteLogin()”rxSummary包(如RevoScaleR )时,不会再次加载像"rxSummary(~.,data=iris)“这样的东西,因此”rxSummary(~.,data=iris)“之类的东西在错误中失败,无法找到函数”rxSummary“

当我从azure部署一个“Linux (Ubuntu)上的机器学习服务器9.2.1”时,也发生了同样的事情。

我不想只使用常规的开源R,我希望能够使用regular -这就是我部署这个VM的原因。我怎样才能让所有的东西都加载R服务器的R,而不是Microsoft?(就像我可以在终端上使用"R")

由于我已经尝试了所有这些,并且result已经加载到控制台中,所以我现在开始使用权限。默认情况下,Data没有正确的权限允许这些操作吗?我不知所措

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-01-31 21:39:03

RStudio服务器安装在Ubuntu上,但是默认情况下服务是禁用的,因为它不支持SSL。您可以使用systemctl启用rstudio-server启用它,然后使用systemctl启动rstudio-server启动它。

RStudio服务器使用与Microsoft相同的R,但是.libPaths不同,这就是为什么不能加载MRS包的原因。您需要手动设置.libPaths,以便它们匹配。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48480541

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档