rApache Web Application Development with R and Apache: Introduction and Installation (Chapter I).

First presented at DSC2005, rApache is a project supporting web application development using the R statistical language and environment and the Apache web server.

 

The current release runs on UNIX/Linux and Mac OS X operating systems.

For some examples of interactive R web applications that use rApache, visit the website of Jeroen Ooms.

 

Download rApache 1.2.5

 

To follow the latest development on github.com, go here:

 

https://github.com/jeffreyhorner/rapache

 

View the Changelog

https://raw.github.com/jeffreyhorner/rapache/master/ChangeLog

rapache

Ubuntu Package

Convenient installation packages for Ubuntu 12.04 (Precise) and newer are available through Launchpad:

sudo add-apt-repository ppa:opencpu/rapache
sudo apt-get update
sudo apt-get install libapache2-mod-r-base

This manual covers installation, configuration, and various uses for rApache version 1.2.3 and up. Read this manual for all prior versions. This document is intended to contain the most up-to-date information about rApache. Comments, suggestions should be forwarded to the maintainer.


1. Introduction.

rApache is a project supporting web application development using the R statistical language and environment and the Apache web server. The current software distribution runs on UNIX/Linux and Mac OS X operating systems. Apache servers with threaded Multi-Processing Modules are now supported, but the the Apache Prefork Multi-Processing Module is still recommended (refer to the Multi-Processing Modules chapter from Apache for more about this).

 

The rApache software distribution provides the Apache module named mod_R that embeds the R interpreter inside the web server. It also comes bundled with libapreq, an Apache module for manipulating client request data. Together, they provide the glue to transform R into a server-side scripting environment.

 

Another important project that's not bundled with rApache, but plays an important role in server-side scripting, is the R package brew (also available on CRAN). It implements a templating framework for report generation, and it's perfect for generating HTML on the fly. it's syntax is similar to PHP, Ruby's erb module, Java Server Pages, and Python's psp module. brew can be used stand-alone as well, so it's not part of the distribution.


1.1 Rook Support.

Rook is an R package that defines a specification and set of convenience objects for running R web applications on various web servers without the need to modify your code. Thus, you can write and run Rook apps within R using the built-in Rhttpd web server and deploy them on rApache.


1.2 Security.

As with any web server-side scripting environment, rApache is at the mercy of YOU THE PROGRAMMER. If you allow your R code to accept information from a 3rd party, then it is up to you to vet that information appropriately. So, the author maintains that rApache is more or less as secure as other popular web scripting environments such as PHP, Ruby on Rails, etc.


2. Installation.

The best way to install rApache on Debian or Ubuntu systems is using the deb package libapache2-mod-r-base. The control file has been designed to work with either Apache2.2 or Apache 2.4. To build the package from source on Debian/Ubuntu:

sudo apt-get install devscripts git
sudo apt-get install apache2-prefork-dev apache2-mpm-prefork libapreq2-dev r-base-dev
git clone https://github.com/jeffreyhorner/rapache.git
cd rapache
debuild -us -uc
cd ..
sudo dpkg -i libapache2-mod-r-base*.deb

Alternatively, pre-built packages are available for Ubuntu 12.04 (Precise) and newer through Launchpad:

sudo add-apt-repository ppa:opencpu/rapache
sudo apt-get update
sudo apt-get install libapache2-mod-r-base

To uninstall the package:

sudo apt-get purge libapache2-mod-r-base

 

2.1 Building from source.

rApache follows the typical GNU/Linux source install procedure: run 'configure', then 'make', and 'make install' from the shell.

Requirements for installing and using rApache are as follows:

    R built and installed as a shared library (see the Writing R Extensions manual for more info).
    Apache 2.2.x or later installed with module loading support.
    libapreq2 2.05 or higher. This comes bundled with rApache and will be installed by default if not automatically found by configure or overridden with the configure flag --with-apreq2-config.

configure does it's best to probe your system to meet the above requirements. Failing that, you should use the following flags:

    --with-R the full path to R
    --with-apache2-apxs the full path to the Apache extension tool
    --with-apreq2-config the full path to the libapreq2 utility

Here's an example with some common argument values:

./configure \
    --with-R=/usr/bin/R \
    --with-apache2-apxs=/usr/bin/apxs2 \
    --with-apreq2-config=/usr/bin/apreq2-config

If you liked this article, subscribe to the feed by clicking the image below to keep informed about new contents of the blog:

rss_trappola

Share on Google Plus

About Hugo Repetto

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment

Gadget

This content is not yet available over encrypted connections.

My Favorites