R is an open-source language for statistical computing and data analysis; RStudio Server puts a full browser-based IDE for it on a remote machine. This guide installs R from the official CRAN repository, sets up RStudio Server, secures it behind Nginx with Let's Encrypt TLS, and runs a test script with a plot.
Prerequisites: an Ubuntu 24.04 server, non-root sudo user, a domain A record (e.g.
rstudio.example.com).
Install R from CRAN
$ sudo apt update
$ sudo apt install --no-install-recommends software-properties-common dirmngr -y
Add and verify CRAN's key:
$ wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
$ gpg --show-keys /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
Fingerprint should read E298A3A825C0D65DFD57CBB651716619E084DAB9.
$ sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
$ sudo apt install --no-install-recommends r-base -y
Verify:
$ R --version
$ R
> "Hello, R!"
> mean(c(1, 2, 3, 4, 5))
> q()
Answer n when asked to save the workspace.
Install RStudio Server
$ sudo apt install gdebi-core -y
$ wget https://download2.rstudio.org/server/jammy/amd64/rstudio-server-2025.09.2-418-amd64.deb
$ sudo gdebi rstudio-server-2025.09.2-418-amd64.deb
$ sudo rstudio-server version
The Jammy (22.04) package works fine on Noble (24.04) — LTS releases are backward-compatible here.
Start RStudio Server
$ sudo systemctl enable rstudio-server
$ sudo systemctl start rstudio-server
$ sudo systemctl status rstudio-server
Secure with Nginx + Let's Encrypt
$ sudo apt install nginx -y
$ sudo apt install certbot python3-certbot-nginx -y
$ sudo nano /etc/nginx/sites-available/rstudio.conf
server {
listen 80;
server_name rstudio.example.com;
location / {
proxy_pass http://127.0.0.1:8787;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 20d;
}
}
The long proxy_read_timeout keeps long-running RStudio sessions from getting cut off.
$ sudo ln -s /etc/nginx/sites-available/rstudio.conf /etc/nginx/sites-enabled/
$ sudo nginx -t
$ sudo systemctl restart nginx
$ sudo ufw allow 80,443/tcp
$ sudo certbot --nginx -d rstudio.example.com -m admin@example.com --agree-tos --no-eff-email
Access RStudio Server
Visit https://rstudio.example.com, sign in with your Linux user account. Each user gets an isolated R environment — personal package installs don't affect other users.
Run a Test Script
> x <- 1:10
> y <- x^2
> plot(x, y, type="b", col="red", main="Test Plot with RStudio Server")
File → New File → R Script, then:
# Calculate summary statistics
data <- c(12, 15, 18, 22, 25, 28, 30, 35)
summary(data)
# Create a histogram
hist(data, main="Sample Data Distribution", col="steelblue")
Run or Ctrl+Enter to execute.
Next Steps
RStudio Server is running with TLS and isolated per-user R environments. From here:
- Add more Linux users to give teammates their own RStudio logins
- Install commonly-needed CRAN packages system-wide so users don't duplicate installs
- Connect to a database or object storage from within R scripts for real data-analysis workflows
For the full guide, visit the original article on Vultr Docs.
Top comments (0)