目录问题,无法安装 RStudio 服务器包 Ubuntu

Directory Issue, can't install RStudio Server Packages Ubuntu

我设置了一个 Ubuntu 虚拟机,但无法安装软件包。

Installing package into ‘/home/username/R/x86_64-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)

看起来所有默认包都保存在 /usr/lib/R/library

但是 RStudio 正在尝试将新包写入 /home/username/R/x86_64-pc-linux-gnu-library/3.0

.libPaths()
[1] "/home/username/R/x86_64-pc-linux-gnu-library/3.0" "/usr/local/lib/R/site-library"                       
[3] "/usr/lib/R/site-library"                              "/usr/lib/R/library"    

我还尝试通过 FileZilla 将软件包直接上传到 /usr/lib/R/library,但我收到以下错误消息

mkdir /usr/lib/R/library/jsonlite: permission denied

如何安装我需要的包?

今天把这个问题进一步投入,终于解决了。问题是由于 R 版本过时和缺少库(curl,xml)造成的。

$ sudo apt-get install r-base 命令安装服务器上可用的任何版本。

因此获取最新版本很重要

sudo sh -c 'echo "deb http://cran.rstudio.com/bin/linux/ubuntu trusty/" >> /etc/apt/sources.list'

我按照本教程重新安装了 R,以防有人遇到同样的问题。 Setting Up R Studio Server On Microsoft Azure

希望对您有所帮助