How to install R and RStudio on Linux - CentOS or RHEL 7 in 5 minutes

Leave a Comment

R is a programming language used for statistical computing commonly by Data Scientists and analysts. It is free and open source tool under GNU project and R is maintained by R foundation.

In this article we will learn how to install R and R Studio on a Linux server that can be Centos 7 or Red hat Enterprise Linux 7.  

Please note :  You can install either using root user or a non root user with sudo rights.

Step 1 : Install R 

First, you need to install the epel repo for centos and rhel using below command. Make sure yum works on your machine.

sudo yum install

Install R software using below command

sudo yum install R -y

Once yum completes the installation of R package, you may verify the same using below command.

On your Linux machine, run command R, if successfully installed you will see output as given below.

root@techbuzztimes #  R 

You are done with one part that is R installation, next you need to install R studio.

Step 2: Install R studio

You can find the latest version of R studio for Centos and RHEL 7 from here
Make sure wget is installed on your machine, you need to download the package first and then install it using yum command as given below

sudo yum install rstudio-server-rhel-1.3.1093-x86_64.rpm

During the installation, at the end it will try to enable and start the service as shown in below screenshot, make sure Rtsudio service is up and running.

Check the Rstudio service using below command.

systemctl status rstudio-server.service

Make sure service is enabled so that it comes up after the server restarts.

systemctl enable rstudio-server.service

Step 3 : Verify Rstudio GUI 

Ok, so you are done with the installation steps, now you can go ahead and verify the R studio gui on web browser.

By default, R studio runs on port 8787

In your web browser open URL http://hostname:8787

You will see gui like below

You can verify access on the R studio using any user, make sure user exists on the server and having valid home directory on the server, you may check using below command.

getent passwd username

Once successfully logged in, you will see Gui as shown below. All these steps will take between 5 to 10 minutes.  Please let us know how your R studio installation went in comments.




Post a comment