Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

How to integrate and use RStudio Server on OpenShift AI

June 6, 2024
Andriana Theodorakopoulou
Related topics:
Data ScienceIntegrationIDEsOpen source
Related products:
Red Hat OpenShift AI

Share:

    RStudio Server is a powerful open source integrated development environment (IDE) that offers a graphical interface for the R programming language, significantly enhancing data analysis and visualization capabilities. With the rise of data-driven decision-making, having a robust tool like RStudio Server becomes crucial for data scientists and analysts. This guide will walk you through the process of setting up RStudio Server on Red Hat OpenShift AI and getting started with its extensive features.

    Setting Up RStudio Server on OpenShift AI

    The integration of RStudio Server with OpenShift AI provides a scalable and secure environment for data analysis.

    Here’s a step-by-step guide to get you started.

    1. Log in to the cluster. First, access your OpenShift cluster by logging in through the terminal. Ensure that you have installed the OpenShift CLI (oc) if you prefer using the terminal for this procedure; however, all these steps can also be accomplished through the OpenShift UI.

      $ oc login --token=<sha256~token> --server=<cluster API address>
    2. Create a secret for subscription manager credentials. To build the RStudio Server workbench, you must create a secret containing the subscription manager credentials. These are usually your Red Hat Customer Portal username and password. Guidance on acquiring these credentials for the subscription manager is detailed in the following article: How to use Subscription Manager on Red Hat Enterprise Linux. Additionally, you can refer to this Registration Assistant. 

      $ oc create secret generic rhel-subscription-secret --from-literal=USERNAME=<username> --from-literal=PASSWORD=<password> -n redhat-ods-applications

      The secret must be named rhel-subscription-secret, and its USERNAME and PASSWORD keys must be in capital letters.

    3. Build RStudio Server. Ensure your cluster has at least 1 CPU available for the RStudio server and 1.5 CPUs for the CUDA-enabled RStudio server. To start the build process, use the following command:

      a. To start the lightweight RStudio Server BuildConfig:

      $ oc start-build rstudio-server-rhel9 -n redhat-ods-applications --follow

      Alternatively, you can navigate to the Builds menu in the OpenShift UI, locate the rstudio-server-rhel9 flavor under BuildConfigs, and simply initiate the build process by clicking the Start Build button in the Actions drop-down, as shown in Figure 1.

      Figure 1: Illustrates the BuildConfig within the OpenShift console
      Figure 1: Illustrates the BuildConfig within the OpenShift console
      Figure 1: BuildConfig within the OpenShift console.

      b. Accordingly, to start the CUDA-enabled RStudio Server build, trigger the cuda-rhel9 BuildConfig:

      oc start-build cuda-rhel9 -n redhat-ods-applications --follow
     

    Note

    You don't need to manually trigger cuda-rstudio-rhel9 as it will be initiated automatically.

    1. Check the build status with:

      $ oc get builds -n redhat-ods-applications
      Expected output:
      NAME                     TYPE     FROM          STATUS     STARTED          DURATION
      rstudio-server-rhel9-1   Docker   Git@f7976fb   Complete   25 minutes ago   9m1s

      The build process should take approximately 7 minutes for RStudio Server and 25 minutes for the CUDA-enabled version.

    2. Label the ImageStreams. Once the build has been completed, it's necessary to apply opendatahub.io/notebook-image: 'true' label on the ImageStreams to enable the workbench in the OpenShift AI UI. 

      To apply the label, run the following commands on your terminal:

      $oc label imagestream rstudio-rhel9 opendatahub.io/notebook-image='true' -n redhat-ods-applications

      For CUDA-enabled version:

      $ oc label imagestream cuda-rstudio-rhel9 opendatahub.io/notebook-image='true' -n redhat-ods-applications

      Alternatively, you can always do the same through OpenShift UI, you will need to add this label to the labels section. See Figure 2.

    Figure 2: Assigning of opendatahub.io/notebook-image label within ImageStream
    Figure 2: Assigning of opendatahub.io/notebook-image label within ImageStream
    Figure 2: Assigning opendatahub.io/notebook-image label within ImageStream.
    1. Access the RStudio Server workbench. You can now access RStudio Server workbenches on Applications → Enabled menu in the Red Hat OpenShift AI dashboard. 

      Or, in the Data Science Projects → Workbenches → Create workbench → Notebook image → Image selection dropdown list.

    Getting started with RStudio Server

    With RStudio Server successfully set up, it’s time to dive into its features and how to use them effectively.

    Launch RStudio Server

    There are two methods to launch RStudio Server:

    1. Via Workbench Spawner Page: Navigate to Applications → Enabled, click on Launch next to the JupyterHub card, and select RStudio Server Workbench, as shown in Figure 3.
    Figure 3: Workbench Spawner page within OpenShift AI dashboard
    Figure 3: Workbench Spawner page within OpenShift AI dashboard
    Figure 3: Workbench Spawner page within OpenShift AI dashboard.
    1. Via Data Science Projects:Create data science project, select RStudio Server Workbench from the drop-down, and click Create Workbench, as shown in Figure 4. 

      Figure 4: View from Data Science Projects page within OpenShift AI dashboard
      Figure 4: View from Data Science Projects page within OpenShift AI dashboard
      Figure 4: View from Data Science Projects page within OpenShift AI dashboard.

    Figure 5 shows the RStudio Server interface that appears.

    Figure 5: RStudio Server IDE
    Figure 5: RStudio Server IDE
    Figure 5: RStudio Server IDE.

    Explore the RStudio interface

    RStudio Server provides a user-friendly interface that integrates text with code, similar to Jupyter notebooks. Key areas include:

    • Console: Execute R commands, install packages, and perform mathematical operations.
    • Environment: View variables and their values within the workspace.
    • Terminal, History, Files, Plots, Packages: Manage terminal commands, track operation history, navigate files, view plots, and manage packages.

    Perform data analysis

    • Write R scripts: Navigate to File → New File → R Script to create reusable and reproducible scripts.
    • Installing R packages: Use the install.packages("package_name") command in the console for package installation and library() to load them into the R environment.

    By following these instructions, you can effectively integrate and utilize RStudio Server within your OpenShift AI environment, unlocking a world of possibilities for data analysis and visualization. Whether you're conducting basic analyses or developing complex models, RStudio Server on OpenShift AI offers a robust, scalable platform to meet your data science needs! 

    Related Posts

    • Model training in Red Hat OpenShift AI

    • Red Hat OpenShift AI installation and setup

    • How to integrate Quarkus applications with OpenShift AI

    • Why GPUs are essential for AI and high-performance computing

    • Empower conversational AI at scale with KServe

    • Create an OpenShift AI environment with Snorkel

    Recent Posts

    • How to run a fraud detection AI model on RHEL CVMs

    • How we use software provenance at Red Hat

    • Alternatives to creating bootc images from scratch

    • How to update OpenStack Services on OpenShift

    • How to integrate vLLM inference into your macOS and iOS apps

    What’s up next?

    Learn how to access a large language model using Node.js and LangChain.js. You’ll also explore LangChain.js APIs that simplify common requirements like retrieval-augmented generation (RAG).

    Start the activity
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue