littleworth
littleworth

Reputation: 5169

How to make RStudio server recognize location of R version

I'm using the free version of Rstudio Server. And I have a new R version stored under this directory:

/home/ubuntu/.R-4.1.0/bin/R

I want my RStudio to recognize R from that directory. So I made changes in /etc/rstudio/rserver.conf by adding this line to that file:

rsession-which-r=/home/ubuntu/.R-4.1.0/bin/R

Then I restart the server:

sudo rstudio-server restart

However when I reload my R-studio server, it said the site can't be reached. How can I resolve the issue?

enter image description here

Note that, it'll work with this line which is the default R location:

rsession-which-r=/usr/bin/R

Upvotes: 2

Views: 1528

Answers (1)

Dirk is no longer here
Dirk is no longer here

Reputation: 368579

You need to add the R interpreter you want to use to the $PATH, possibly only for the duration of a caller script. For example when I do (in a standard Ubuntu shell in Terminal)

PATH="/usr/local/lib/R-devel/bin:$PATH" rstudio

then RStudio (desktop) starts with my local, usually off-path, version of R-devel instead of my default (Ubuntu) R 4.1.0.

So you would do

PATH="/home/ubuntu/.R-4.1.0/bin/:$PATH" rstudio-server

to start RStudio server. You can layer this and make the above a script in /usr/local/sbin (say) to be found before your actual rstudio server instance.

The easier solution, of course, may be to just install R 4.1.0 for Ubuntu from CRAN as described in the standard README.

Upvotes: 1

Related Questions