Linux – Use shell scripts to automate the installation of R-Studio

Use shell scripts to automate the installation of R-Studio… here is a solution to the problem.

Use shell scripts to automate the installation of R-Studio

Is there any way to automatically install R-Studio on a Linux system? It should automatically detect the operating system and install R and R-Studio with the required dependencies.
Thanks…

Solution

I have prepared the following shell script to fully automate this installation.

#!/bin/bash
# ******************************************
# Program: R-Studio Installation Script
# Developer: Pratik Patil
# Date: 16-04-2015
# Last Updated: 16-04-2015
# ********************************************

if [ "`lsb_release -is`" == "Ubuntu" ] || [ "`lsb_release -is`" == "Debian" ]
then
    sudo apt-get -y install r-base gdebi-core libapparmor1;
    sudo wget http://download2.rstudio.org/rstudio-server-0.98.1103-amd64.deb;
    sudo gdebi rstudio-server-0.98.1103-amd64.deb;

elif [ "`lsb_release -is`" == "CentOS" ] || [ "`lsb_release -is`" == "RedHat" ]
then
    sudo yum -y install R openssl098e;
    sudo wget http://download2.rstudio.org/rstudio-server-0.98.1103-x86_64.rpm;
    sudo yum -y install --nogpgcheck rstudio-server-0.98.1103-x86_64.rpm;
else
    echo "Unsupported Operating System";
fi

sudo rm -f rstudio-server-*;
sudo rstudio-server verify-installation;

How do I start R-Studio on an Ubuntu or Debian system?
Enter the following command in the terminal:

rstudio;

How do I start R-Studio on CentOS or RedHat?
Open the following URL in your browser:

http://localhost:8787

The login prompt appears, and then log in with the current system user credentials.

Related Problems and Solutions