Automated Installation of R-Studio Using Shell Script
I have prepared the following shell script to make this installation fully automated.
#!/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 to Launch R-Studio in Ubuntu or Debian Systems?
Enter the following command on the terminal:
rstudio;
How to Launch R-Studio in CentOS or RedHat Systems?
Open the Following URL in browser:
http://localhost:8787
After that Login prompt will appear & then Login with the current system user credentials.
Loading R package inside R script
The solution is loading the package by require()
require(dplyr)
Installing R packages with bash script - responding to prompts
A different approach that works much better than what I originally posted:
In bash:
Create a specific library for installation (the same as the default R will want to create)
mkdir -p R/x86_64-pc-linux-gnu-library/3.3
Rscript --vanilla install_packages.R
In install_packages.R:
pkg_list <- # however you want to get this
for (pkg in pkg_list) {
install.packages(pkg, repos = "your_cran_mirror",
lib = "R/x86_64-pc-linux-gnu-library/3.3")
if (!require(pkg, character.only = T)) {
quit(save = "no", status = 1, runLast = FALSE)
}
}
Using this method, R will not prompt you and your script will run as intended.
Related Topics
How The File Size Is Limited on a Specific File System
How to Compile a Node C++ Addon So That I Can Use Distribute It on Amazon Aws
What Means "Atomic" System Call
Re-Stream a Mpeg2 Ts Pal Stream with Crtmpserver
Proxmox with Opnsense as Firewall/Gw - Routing Issue
Find Syslog Max Message Length
What Are Coding Conventions for Using Floating-Point in Linux Device Drivers
Permission Denied: '/Var/Lib/Pgadmin/Sessions' in Docker
Virtually Contiguous VS. Physically Contiguous Memory
Terraform - Unable to Run Multiple Commands in Local Exec
How to Use Opengl Without a Window Manager in Linux
Linux/Cygwin Recursively Copy File Change Extension
.Lis Files Generated While Compiling Pro*C Code in Linux
What Special Meaning Does an Equal-Sign Have in Zsh
How to Find Performance of Individual Functions in a Process Using Perf Tool