Install and configure R and RStudio

Need to install R first and then rstudio.
For installing R
first enable epel repo:
# wget http://mirror.chpc.utah.edu/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
# subscription-manager repos --enable rhel-6-server-optional-rpms
# yum install texinfo-tex udunits2-devel udunits2
# yum install R
Prerequisites
yum -y install libcurl libcurl-devel libxml2 libxml2-devel xorg-x11-server-Xvfb xorg-x11-server-devel libX11 libX11-devel mesa-libGL mesa-libGL-devel mesa-libGLU mesa-libGLU-devel freeglut freeglut-devel libpng-devel
And also export the following:
# vi /etc/profile

export HADOOP_HOME=/usr/hdp/2.6.3.0-235/hadoop
export HADOOP_CONF_DIR=/usr/hdp/current/hadoop-client/etc/hadoop
export SPARK_HOME=/usr/hdp/current/spark2-client
export SPARK_CONF_DIR=/etc/spark2/conf
export JAVA_HOME=/mnt/vol1/jdk1.8.0_144
export JAVA_LIBS="$JAVA_LIBS -ldl"
export PATH=$PATH:$HADOOP_HOME:$HADOOP_CONF_DIR:$SPARK_HOME:$SPARK_CONF_DIR:$JAVA_LIBS:$JAVA_HOME

# source /etc/profile
RedHat/CentOS 6 and 7
 To download and install RStudio Server open a terminal window and execute the 
commands corresponding to the 32 or 64-bit version as appropriate.
64bit
Size:  43.5 MB MD5: 1e973cd9532d435d8a980bf84ec85c30 Version:  1.1.383 Released:  2017-10-09
$ wget https://download2.rstudio.org/rstudio-server-rhel-1.1.383-x86_64.rpm
$ sudo yum install --nogpgcheck rstudio-server-rhel-1.1.383-x86_64.rpm
If you are unable to access the server after installation, you should 
run the verify-installation command to output additional diagnostics:
$ sudo rstudio-server verify-installation
If running then:
# netstat -plant | grep 8787
tcp        0      0 0.0.0.0:8787                0.0.0.0:*                   LISTEN      726986/rserver
Create user to access rstudio
# useradd -u 50010 -e 2999-01-05 -c "rstudio local user" rstudio
# passwd rstudio

$ hadoop fs -mkdir -p /user/rstudio
$ hadoop fs -chown -R rstudio:rstudio /user/rstudio

# R CMD javareconf
Java interpreter : /usr/java/jdk1.8.0_144/jre/bin/java
Java version     : 1.8.0_144
Java home path   : /usr/java/jdk1.8.0_144
Java compiler    : /mnt/vol1/jdk1.8.0_144/bin/javac
Java headers gen.: /mnt/vol1/jdk1.8.0_144/bin/javah
Java archive tool: /mnt/vol1/jdk1.8.0_144/bin/jar

trying to compile and link a JNI program
detected JNI cpp flags    : -I/usr/java/jdk1.8.0_144/include -I/usr/java/jdk1.8.0_144/include/linux
detected JNI linker flags : -L/mnt/vol1/jdk1.8.0_144/jre/lib/amd64/server -ljvm -ldl
gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -I/usr/java/jdk1.8.0_144/include -I/usr/java/jdk1.8.0_144/include/linux  -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic -fPIC   -c conftest.c -o conftest.o
gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -o conftest.so conftest.o -L/mnt/vol1/jdk1.8.0_144/jre/lib/amd64/server -ljvm -ldl -L/usr/lib64/R/lib -lR


JAVA_HOME        : /usr/java/jdk1.8.0_144
Java library path: /mnt/vol1/jdk1.8.0_144/jre/lib/amd64/server
JNI cpp flags    : -I/usr/java/jdk1.8.0_144/include -I/usr/java/jdk1.8.0_144/include/linux
JNI linker flags : -L/mnt/vol1/jdk1.8.0_144/jre/lib/amd64/server -ljvm -ldl
Updating Java configuration in /usr/lib64/R
Done
Starting and Stopping
$ sudo rstudio-server stop
$ sudo rstudio-server start
$ sudo rstudio-server restart
Removing RStudio:
# yum remove rstudio-server-1.1.383-1.x86_64
Managing Active Sessions
There are a number of administrative commands which allow you to see what 
sessions are active and request suspension of running sessions 
(note that session data is not lost during a suspend).
To list all currently active sessions:
$ sudo rstudio-server active-sessions
To suspend an individual session:
$ sudo rstudio-server suspend-session <pid>
To suspend all running sessions:
$ sudo rstudio-server suspend-all
The suspend commands also have a "force" variation which will send an 
interrupt to to the session to request the termination of any running R 
command:
$ sudo rstudio-server force-suspend-session <pid>
$ sudo rstudio-server force-suspend-all
Taking the Server Offline
 If you need to perform system maintenance and want users to receive a 
friendly message indicating the server is offline you can issue the following 
command:
$ sudo rstudio-server offline
When the server is once again available you should issue this command:
$ sudo rstudio-server online
0 Comments

There are no comments yet

Leave a comment

Your email address will not be published. Required fields are marked *