RStudio Server Management Notes

less than 1 minute read

Published:

This is my personal notes to update and maintain RStudio Server, codes are imported from the official website and some stackoverflow resources.

Install and include packages from custom directory

# Installation
install.packages("Package", dependencies= TRUE, lib="YourDirectory")
# Include the path to R environment
.libPaths(c(.libPaths(), "YourDirectory"))

Connect to RStudio Server

# In terminal, the default port is 8787
ssh -N -f -L 8787:localhost:8787 ServerAddress
# In browser window
http://localhost:8787/
# Close the port after use in the terminal
lsof -ti:8787 | xargs kill -9

Update RStudio Server

# 1. Notify users ahead of time of the upgrade
# 2. Suspend active sessions
sudo rstudio-server suspend-all
# 3. Set rstudio offline
sudo rstudio-server offline
# 4. Install the latest version
# Check file names from here: https://posit.co/download/rstudio-server/
# 5. Restart rstudio
sudo rstudio-server restart
# 6. Put the new version online
sudo rstudio-server online