Skip to main content

How To Install R and R Studio Server On Centos

How To Install R and R Studio Server On Centos

R is extensively used for data processing and analyzing. R has gained lot of popularity over the last few years because of data explosion over the mobile and web applications.

To leverage the power of R and its eco system, one needs to have complete R suite of tools installed. Although there is large community of R developers and system administrators, I couldn't find a good resource where I could find everything about installing R and its tools in simple easy steps. That's why I decided to write this post. In this post, I will talk about installing following...
  1. R
  2. R Studio Server
  3. R Studio Connect

Install R

Please run following two commands to install R.

sudo yum install epel-release
sudo yum install R

Type R -verson in your bash shell. You should see following output depending upon what version of R you have.

To Bring up the R repl. Just type R and you should have your R shell started. To install any package in R, just do install.packages("<package_name>") inside the R repl. For example to install tidyverse which is very popular data maniuplation R package, just type following and command and hit enter.


R will install in to /usr/lib64/R/library.

Install R Studio Server

R Studio is a very powerful software for writing R scripts and also for building R applications. R studio has cloud version too which once installed can be accessed over any web browser. To install R studio server on centos, go to link and copy and paste the installation commands based on your Centos version. I have Centos 7.

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

Ok the above will install the R studio server. To check the installation, run following command in your bash shell...

rstudio-server  verify-installation

If you see the following message, it means R server is installed properly and it is running fine.
Server is running and must be stopped before running verify-installation

By default, R studio is available on port 8787.
Go to the above link and you should see following screen.
Note: If you want to access the R studio over an IP address. You need to open the port 8787.
Rstudio Server Authentication: By default, PAM authentication is enabled. Therefore use the same user name and password that you used to login to use Centos machine.

Once you login, you should see R studio opened in your browser.

Install R Studio Connect

R studio Connect helps you publish Shiny apps over the web. 
Go to link and run following commands based on your Centos version. For Centos 7 run following commands.

curl -LO
sudo yum install rstudio-connect-1.8.4-11.el7.x86_64.rpm

Above commands will install the Rstudio-connect. To start rstudio-connect, run following command.

service rstudio-connect start

Rstudio-connect has multiple ways to setup authentication. The easiest one is PAM. To enable PAM authentication look for following config file


Open the above file in your favorite editor and change Provider = pam.

; Specifies the type of user authentication.
Provider = pam

Now restart the service again.

service rstudio-connect start

Ok now the rstudio-connect is installed and running successfully.  To publish R shiny apps from the R studio server using rstudio-connect, we need to add the account to R studio. To do that, go to your Rstudio and load your Shiny app. Now to button which is right next to "run apps", click on it and choose "other destinations'

In the new pop up window, choose the option "Add New Account"

Then choose option "Rstudio Connect"

Add your ip or domain address

Once you do that, click on "Connect". This will open up Rstudio-Connect pop up for authentication. Fill in your PAM login and password informtion. After successful authentication the screen in Rstudio will change to following...

Click on "Connect Account" You would your other screen "Rstudio Connect" will change with congratulation message. That means you have successfully connected the Rstudio Connect with Rstudio.
Now in Rstudio, go to the blue icon again which is right next to "Run app" and choose your R shiny app to publish. A new pop up will show up asking you to choose the account to publish the app. Choose your newly activated Rstudio connect account.  You would see your browser directing you to following link...

Note: If you are using your domain or Ip address, you need to open up the port 3939.

Wrap Up

I hope you would find the above post useful for installing R and R tools. 


Popular posts from this blog

Linux CSV Command Line Tool XSV

Linux CSV Command Line Tool XSVlast updated: August 8th,2020 by AadiIn this post, I will introduce an excellent command line tool XSV for the CSV file parsing and data manipulation. You can install the tool from github
Let us begin the tutorial.
If you are on Centos, following installation commands will work.
yum install cargocargo install xsv
By default cargo installs it in /root/.cargo/bin/xsv
If you are not root, you might have to set either alias or add the tool in your bash PATH.
alias xsv=/root/.cargo/bin/xsvAs an example, I would look at the stocks data which I downloaded from Yahoo Finance for the Apple stock.
Ok let us first look at our data.

Read Csv file using Xsv
Ok, now let us try using the Xsv command "xsv table". Xsv table would show the data in nice tabular form. Instead of Linux 'head -2' command, we can also use Xsv slice command

How To Crawl Coupon Sites With Python

How To Crawl Coupon Sites With Python In this post, i will show you how to use Python and LXML to crawl coupons and deals from couponsites. The purpose of this post is to help users write crawlers with Python.
To demo this, I will crawl coupons from and
Example 1 Let us start with first.
Let us first import the following two libraries..
import requests import lxml.html Most of the coupon sites have thousands of coupon pages. Most of the times, these pages are per company or site. These pages are structured templates. Therefore when we write a crawler for one coupon page, then it should work for all the coupon pages. In the case of couponannie also, this is the case.
Let us pick the following url and extract the coupons and its related information.
url = '' We will use requests to get the content of above page as shown below.
obj = requests.get(url) Let us co…