The two are available at: http://rforge.net/Rserve/ and http://rforge.net/FastRWeb/
All the steps below were performed as root unless specified otherwise.
Rserve
1. Check the version of R and if it is not installed install R. You may have to install new repository EPEL i.e. Extra Packages for Enterprise Linux. Here is a page describing that http://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/
yum install R
Now I have R version 3.1.1 (2014-07-10) working
2. Start R and type
install.packages("Rserve")
|
Once install process is done you can check the instal files using
ls -al /usr/lib64/R/library/Rserve/
3. Created a file /etc/Rserv.conf with following content to run the R process as apache
uid apache gid apache workdir /tmp/Rserv fileio enable port 6311 maxinbuf 262144
4. Start Rserve and check if running then stop it
R CMD Rserve --gui-none --no-save ps -eaf | grep Rserve
killall Rserve
5. Add a startup script by creating a file /etc/init.d/Rserve and adding the content. Thanks to (http://paranumeral.blogspot.com/2013/03/a-basic-etcinitdrserve-start-rserve-at.html) on which I have used most of the content.
#!/bin/sh
# chkconfig: 2345 20 80
#
# description: rserve startup script
#
RSERVE=/usr/lib64/R/bin/Rserve
. /etc/rc.d/init.d/functions
test -f /etc/Rserv.conf
export R_HOME=/usr/lib64/R
RETVAL=0
case "$1" in
start)
echo -n "Starting Rserve: "
[ -f $RSERVE ] || exit 1
$RSERVE --gui-none --no-save
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/rserve
;;
stop)
echo -n "Shutting down RServe: "
killproc $RSERVE
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/rserve
;;
restart|reload)
$0 stop
$0 start
RETVAL=$?
;;
status)
status $RSERVE
RETVAL=$?
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit $RETVAL
6. Change permissions of auto start script, test start and stopping:
chmod 755 /etc/init.d/Rserve service Rserve start service Rserve stop
7. Finally configure to start with reboot of machine
chkconfig --level 2345 Rserve on
No comments:
Post a Comment