Skip to content

RStudio Server

RStudio Server provides a web-based IDE for R, running on a compute node and accessible through your local browser. You get the full RStudio experience with access to cluster resources, your files, and all installed R packages.

Availability

RStudio Server is currently available on Hyperion only.


Step 1: Submit the batch script

Save the following as rstudio.slurm:

rstudio.slurm
#!/bin/bash
#SBATCH --job-name=rstudio
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --mem=16G
#SBATCH --time=08:00:00
#SBATCH --qos=regular
#SBATCH --output=rstudio-%j.out
#SBATCH --error=rstudio-%j.err

module load RStudio-Server
start_rstudio_server.sh

Submit it:

sbatch rstudio.slurm

If you are not familiar with the #SBATCH flags, the SLURM reference explains each directive in detail. Adjust --cpus-per-task, --mem, and --time to fit your needs.

Step 2: Check the log

Wait for the job to start running:

squeue -u $USER

Once the state changes to R (running), read the output file:

cat rstudio-<JOBID>.out

You will see something like this:

================================================================================
                         RSTUDIO SERVER SESSION INFO
================================================================================

  Job ID:       1234567
  Node:         hyperion-107.sw.ehu.es
  Port:         8945
  Username:     <username>
  Password:     xK9mPq2wL5nR

--------------------------------------------------------------------------------
  CONNECTION INSTRUCTIONS
--------------------------------------------------------------------------------

  1. Open a terminal on your local machine and run:

     ssh -N -L 9999:localhost:8945 -J <username>@hyperion.sw.ehu.es hyperion-107

  2. Open your web browser and navigate to:

     http://localhost:9999

  3. Log in with the credentials above.

================================================================================

The log gives you everything you need: the tunnel command, the URL, the username, and the password.

Save your password

The password is randomly generated for each session. Note it down before closing the log.

Step 3: Create the SSH tunnel

On your local machine, open a terminal and run the tunnel command from the log:

ssh -N -L 9999:localhost:8945 -J <username>@hyperion.sw.ehu.es hyperion-107

Windows 10 and later include an OpenSSH client. Open PowerShell or cmd and run the same command:

ssh -N -L 9999:localhost:8945 -J <username>@hyperion.sw.ehu.es hyperion-107

Replace the port, username, and node with the actual values from your log. The terminal will appear to hang with no output; that is normal. Keep it open while you use RStudio.

For more details on SSH tunneling, see the SSH tunneling section in the connection guide.

Port already in use

If the local port (e.g., 9999) is taken, pick another one and update the URL in your browser accordingly.

Step 4: Open RStudio in your browser

Navigate to:

http://localhost:9999

Enter the username and password from the log (not your cluster password). The full RStudio interface will load in your browser.


Tips for using R on the cluster

Parallel computing

Your R session has access to the CPU cores you requested. You can use them with:

library(parallel)
results <- mclapply(1:100, my_function, mc.cores = 4)

Other options include foreach/doParallel and future/future.apply.

Working directory

RStudio has direct access to all your cluster filesystems. For job-related data, work from /scratch:

setwd("/scratch/<username>/my_project")

See the Data transfer page for an overview of the available filesystems.

Large datasets

For large files, data.table::fread() and vroom::vroom() are significantly faster than base R functions. For saving R objects, saveRDS()/readRDS() or the qs package provide fast binary storage.


Stopping the server

To end your RStudio session, cancel the batch job:

scancel <JOBID>

You can find the job ID with squeue -u $USER.

Warning

Simply closing the browser tab does not terminate the SLURM job. The job continues running until it reaches its time limit or you cancel it explicitly.


Troubleshooting

Connection refused

Verify the SSH tunnel is running and that your job is still active (squeue -u $USER). Check that the local port in your browser URL matches the one in your tunnel command, and the remote port matches the one from the log.

Connection drops immediately

Make sure you are using the ProxyJump (-J) syntax as shown in the examples. Verify you are connecting to the correct compute node.

Authentication failed

Use your cluster username (not email) and the password from the log (not your cluster password). Passwords are case-sensitive.

RStudio shows a blank page or loading spinner

Clear browser cache and reload. Try a different browser (Chrome and Firefox work best). Check the error file: cat rstudio-<JOBID>.err.

Session becomes unresponsive

Your SLURM job may have reached its time limit. Check with squeue -u $USER and submit a new job with longer --time if needed.


See also

  • R on the clusters


    Installing R packages and managing R environments.

    R guide

  • SLURM reference


    Batch script directives, partitions, and resource options.

    SLURM guide

  • code-server


    Full VS Code in the browser, running on a compute node.

    code-server guide

  • Jupyter Notebook


    Run notebooks on compute nodes via SSH tunnel.

    Jupyter guide