How do I switch the version of R my RStudio Server uses?

I'm running R Studio on an EC2 instance. The instance was old and didn't come with the latest version of R, so I updated it myself using these commands.

sudo yum-builddep R
wget https://cran.r-project.org/src/base/R-3/R-3.5.3.tar.gz
tar xvzf R-3.5.3.tar.gz
cd R-3.5.3
./configure --prefix=/opt/R/3.5.3 --enable-R-shlib
make
sudo make install
./configure --prefix=/opt/R/3.5.3 --enable-R-shlib --with-blas --with-lapack
sudo ln -s /opt/R/3.5.3/bin/R /bin/R

It's on this Linux box.

How do I update the version of R that my R Studio Server uses?

I've tried

RSTUDIO_WHICH_R=/opt/R/3.5.3/bin/R
sudo RSTUDIO_WHICH_R=/opt/R/3.5.3/bin/R
export RSTUDIO_WHICH_R=/opt/R/3.5.3/bin/R

When I enter Which R, it still gives me the location for the old version of R.

/bin/R

It won't let me delete this. I figured out what to do. I needed to add the option to my config file.

You have to modify your PATH variable, I don't know if it's the same for your linux version but on debian you can also do it by editing this file

sudo nano /etc/init.d/rstudio-server
# Modify your PATH for ussing the compiled version of R
	# PATH=/usr/local/bin/:/sbin:/usr/sbin:/bin:/usr/bin

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.