How to install RStudio Server open source on Ubuntu 20.04 LTS

RStudio is a development IDE for R language programmers, however, if you are not on GUI and using CLI server still we can have the benefit of it by installing the Rstudio Server edition. It provides the Rstudio IDE access via a web browser interface, thus if you have some remote Linux server with powerful hardware for high-level computing then installing the Rstudio server will be a nice idea. Because in this way multiple developers can easily use this R language development platform for coding, editing, and sharing of other files with the team. Furthermore, a server environment of Rstudio will give a centralized installation of R, R packages, TeX, and other supporting libraries.

The best thing, Rstudio is available in both open-source and commercial versions, thus, if you have any popular Linux distributions including Debian, Ubuntu, and RedHat/CentOS/Fedora we can install it.

Add GPG Key for R-base

On Ubuntu 20.04, we would not be able to install R-base using the official repository source, at least while performing the tutorial I couldn’t thus, here we are going to install it by adding its repo. Therefore, to make sure the packages we are getting are from the original source, the system needs the GPG key issued by the developer.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

Add R-base repository

Next, to download the R packages, define its source by adding the repo URL.

sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/"

Run update

To flush the cache and let the system rebuild a new one, run the update command:

sudo apt update

Install Gdebi

To easily install Rstudio Desktop or Server, we will use the Gdebi Package manager that will automatically fetch and install the required dependencies needed by the tool.

sudo apt-get install gdebi-core

Download RStudio Server package

While performing this tutorial, the latest Rstudio version was 1.3.1093, you can install it or just replace the version in the below download link with the latest or old one.

For Debian 8 / Ubuntu 16

wget https://download2.rstudio.org/server/xenial/amd64/rstudio-server-1.3.1093-amd64.deb

For Debian 10 / Ubuntu 18 / Ubuntu 20

wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-2021.09.1-372-amd64.deb

Check out the file name:

ls

Installation command:

sudo gdebi package-name

Note: Replace package-name in the above command with the downloaded Rstudio file. For example, here we have downloaded rstudio-server-2021.09.1-372-amd64.deb thus the command will be:

sudo gdebi rstudio-server-2021.09.1-372-amd64.deb

or

sudo apt install ./rstudio-server-2021.09.1-372-amd64.deb

or

sudo dpkg -i rstudio-server-2021.09.1-372-amd64.deb

 

Sample output:

Setting up rstudio-server   ...
Created symlink /etc/systemd/system/multi-user.target.wants/rstudio-server.service → /lib/systemd/system/rstudio-server.service.
â—Ź rstudio-server.service - RStudio Server
Loaded: loaded (/lib/systemd/system/rstudio-server.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2020-10-15 13:50:54 IST; 1s ago
Process: 3000 ExecStart=/usr/lib/rstudio-server/bin/rserver (code=exited, status=0/SUCCESS)
Main PID: 3002 (rserver)
Tasks: 3 (limit: 4623)
Memory: 2.2M
CGroup: /system.slice/rstudio-server.service
└─3002 /usr/lib/rstudio-server/bin/rserver

Oct 15 13:50:54 h2s-virtual-machine systemd[1]: Starting RStudio Server...
Oct 15 13:50:54 h2s-virtual-machine systemd[1]: Started RStudio Server.

Create Users to Access Rstudio

Yes, of course, we can use our current root or non-root user to access the Rstudio web interface, however, if you have multiple members or developers in the team and all of them need access to Web Rstudio IDE, then create different users one by one.

The command to create a new user is:

sudo adduser h2s

Note: Replace the h2s with the username that you want to create and use with Rstudio.

 

Open and Access Rstuio

To access this R web-based development platform simply note down the server-ip-address and use that with port number 8787. For instance, if our server where we have installed the Rstudio is 192.168.0.15 then in the browser it will be like this:

192.168.0.05:8787

Once you have the login screen, use the username and password you have created.

Login Rstudio web server R base server coding Rstudio Web interface server

 

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.