RStudio Server on GCP: the right way

This quick tutorial details how to install a RStudio Server on a Google Cloud Virtual Machine (VM), and how to easily enable remote access in a secure manner through SSH port forwarding.

sudo apt-get update
sudo apt-get -y upgrade
sudo apt -y install r-base r-base-dev
R --version
sudo apt-get install gdebi-core wget
wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-1.3.1093-amd64.deb
sudo gdebi rstudio-server-1.3.1093-amd64.deb
sudo apt-get install libcurl4-openssl-dev libssl-dev libxml2-dev
gcloud compute ssh --zone <zone> <VMname> --project <projectName> -- -L 1080:localhost:8787

— Considerations

sudo rstudio-server start
sudo rstudio-server stop
sudo rstudio-server status

Computational Biologist & Data Scientist

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store