Skip to content

How to install RStudio on Ubuntu Linux

RStudio is one of the most popular integrated development environments (IDE) for R, and it is available on a variety of systems, including Ubuntu. If you intend to use the R programming language for statistical analysis or data visualization, then downloading RStudio will be an essential step in getting started. R is a powerful, open source language that is licensed under the GNU General Public License (GPL).

As with most other programming languages, it is easier to work on your projects inside of a full feature IDE, such as RStudio. In this tutorial, we will go over the step by step instructions to install RStudio, as well as the R langauge itself (a dependency required for RStudio) on Ubuntu Linux. These instructions will work on all supported LTS versions of Ubuntu, including 20.04, 22.04, and 24.04 Noble Numbat. Let’s get started!

In this tutorial you will learn:

  • How to install the R programming language and dependencies
  • How to install RStudio on any Ubuntu LTS version
How to install RStudio on Ubuntu Linux
How to install RStudio on Ubuntu Linux
CategoryRequirements, Conventions or Software Version Used
SystemUbuntu Linux LTS versions 20.04, 22.04, 24.04
SoftwareRStudio
OtherPrivileged access to your Linux system as root or via the sudo command.
Conventions# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Installing RStudio on Ubuntu Linux


https://8b776b4c2f1dc7cd0940d8b9116a6f27.safeframe.googlesyndication.com/safeframe/1-0-40/html/container.html

Follow along with the step by step instructions below to install the R programming language and the RStudio IDE on your Ubuntu Linux system:

  1. R Programming Language InstallationThe first few steps will involve installing the R programming language itself. You can skip these steps if you already have it installed, although following along will at least update R to the latest version, which is always a good idea. Let’s get started by opening a command line terminal and executing the following apt commands to install the prerequisite packages for R:$ sudo apt update $ sudo apt install –no-install-recommends software-properties-common dirmngr
  2. Next, let’s download and add the signing key for the R software package that we will install in the next step:$ wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
  3. Now we will be able to add the official R software repository to our Ubuntu system by executing the following command:$ sudo add-apt-repository “deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/” Press Enter when prompted.NOTE

    Note that the $(lsb_release -cs) command above will automatically determine the name of your Ubuntu version – such as focal, jammy, or noble. This will ensure that the correct repository gets added for your version of Ubuntu.
  4. Next, execute the following command to install the latest version of the R programming language and all of its dependency packages:$ sudo apt install –no-install-recommends r-base
  5. RStudio InstallationNow that R has been installed, we can move on to installing the RStudio IDE. Use your web browser to open the official RStudio download page, and then locate the version that corresponds to your operating system.Downloading RStudio from the official website on Ubuntu
  6. After the download completes, open a command line terminal and navigate to wherever the .deb file is located. Then, we will install the DEB package by executing:$ cd ~/Downloads $ sudo apt install ./rstudio-* The apt package manager will then install the RStudio software and download any required dependency packages in the process.DID YOU KNOW?

    If you get a warning in your terminal – Download is performed unsandboxed as root – you can safely ignore it, and RStudio should work as expected.
  7. With the installation complete, we can open RStudio by searching for it in Ubuntu’s application launcher:Opening the newly installed RStudio program on Ubuntu LinuxIt is also possible to launch RStudio from the command line by simply executing rstudio:$ rstudio
  8. RStudio should launch, and then you can get started with opening existing projects or creating something new in the R programming language:RStudio application running on Ubuntu Linux
  9. Troubleshooting InstallationSome readers may receieve the following error when first attempting to launch RStudio, as we did on our test system:[7066:0730/230400.038126:FATAL:setuid_sandbox_host.cc(158)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I’m aborting now. You need to make sure that /usr/lib/rstudio/chrome-sandbox is owned by root and has mode 4755. Trace/breakpoint trap (core dumped) In this case, the fix is in the error message itself. Let’s apply this solution in the steps below.
  10. We can fix the error and get RStudio to open successfully by first running the following commands:
    https://8b776b4c2f1dc7cd0940d8b9116a6f27.safeframe.googlesyndication.com/safeframe/1-0-40/html/container.html$ sudo chown root:root /usr/lib/rstudio/chrome-sandbox $ sudo chmod 4755 /usr/lib/rstudio/chrome-sandbox These commands will change the file permissions to the proper values that RStudio is expecting.

Closing Thoughts

In this tutorial, we saw how to install the RStudio IDE on an Ubuntu Linux system. This included all currently supported LTS releases of Ubuntu, 20.04 Focal Fossa, 22.04 Jammy Jellyfish, and 24.04 Noble Numbat. We also learned how to install the R programming language itself, which is a prerequisite for RStudio and allows us to utilize the language for development on Linux.

Leave a Reply

Your email address will not be published. Required fields are marked *