RApache install in Ubuntu 10.04 LTS

1. Install R (not detailed here)

2. Update R – I updated R from inside with update.packages() (! or similar)

3. RApache install

  • we need the prefork only for apreq2 libraries,  so even if you have Apache working do this.

apt-get install r-base-dev apache2-mpm-prefork apache2-prefork-dev
wget http://biostat.mc.vanderbilt.edu/rapache/files/rapache-latest.tar.gz
rapachedir=`tar tzf rapache-latest.tar.gz | head -1`
tar xzvf rapache-latest.tar.gz
cd $rapachedir
make install

4. Create a file for R config

nano /etc/apache2/mods-available/r.conf

  • with the following content
  • ROutputErrors
    SetHandler r-info
    # hangs if the modules are not available
    #REvalOnStartup "library(DBI); library(RMySQL)"
    #RSourceOnStartup "/var/www/r/startup.R"
    SetHandler r-script RHandler sys.source

    5. Create a module for apache

    nano r.load

    with the following content

    LoadModule R_module /usr/lib/apache2/modules/mod_R.so

    6. Add module to Apache

    a2nmod r

    7. Reload Apache

    /etc/init.d/apache2 reload

    8. Check your installation at


    9. Test it


    startup.R file content

    get = str(GET)
    d = LETTERS[1:4]
    print (d)

    Should print

    List of 2
    $ a: chr "1"
    $ b: chr "2"
    [1] "A" "B" "C" "D"

    About this entry