You are here: Wiki>Geostatistics Web>WPS4R>WPS4RDebian (23 Jul 2014, DanielNuest)Edit Attach

Install WPS4R on Debian


This tutorial shows the steps to install WPS4R on a Linux server, including R.

Prerequisites

  • Follow the steps in WpsDebianInstallation, ALERT! including GeoTools (build and configuration file)
  • R (see http://cran.r-project.org/bin/linux/debian/README.html) and Rserve (see http://www.rforge.net/Rserve/).
    • R Version: WPS4R should work with all R versions as long as Rserve is working. Given the continuous improvements of R we recommend installing the latest available version. The linked tutorial for Linux uses several version numbers in its text, using a generic "version-number.x.x" if steps are not specific for a version.
      If you follow the steps in the tutorial, you will install the latest available version.
    • CRAN mirror: The CRAN mirrors all contain (potentially with a small delay) the same software/packages and you should pick one that is "close" to you (maybe even within your own university network). If you cannot decide: the RStudio mirrors are deemed to be quite fast as they internally use a content delivery network: http://cran.rstudio.com/.
    • R short summary:
      sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
      echo "deb http://cran.rstudio.com/bin/linux/debian wheezy-cran3/" | sudo tee -a /etc/apt/sources.list
      apt-key adv --keyserver keys.gnupg.net --recv-key 381BA480
      
      sudo apt-get update
      
      sudo apt-get install r-base r-base-dev

Installation steps

1) Configure Rserve

sudo nano /etc/Rserv.conf

Add (at least) the following two lines:
encoding utf8
remote disable

For more configuration options see http://www.rforge.net/Rserve/doc.html.

2) Start Rserve Daemon (optional)

Type the following command to start Rserve.

R CMD Rserve

You should get some output ending in "Rserve started in daemon mode." For details see http://www.rforge.net/Rserve/faq.html.

To check if Rserve is already running type

ps ax|grep Rserve

Alternatively, you can let the WPS start Rserve, which results in the user running the WPS, e.g. user tomcat7, also executing the Rserve command. This has to be taken into account when configuring directories and access rights.

Troubleshooting

If you get the message "Rserve not found", then install the package within an R session run by sudo so that all users can access the extension package.

Test your Rserve connection by typing the following command:

telnet localhost 6311

You should get output containing "Connected to localhost.". You can return to the prompt by hiting the enter key.

3) Configure WPS

By default, the WPS configuration file is quite limited and you must activate WPS4R processes.

Open the configuration file:

sudo nano /home/tomcat7/wps_config.xml=

Snd set the XML-property active to true for the LocalRAlgorithmRepository so that the file contains the following line.

<Repository name="LocalRAlgorithmRepository"
                        className="org.n52.wps.server.r.LocalRAlgorithmRepository" active="true">

While you are at it, you might also want to disable other repositories.

You can also change all WPS4R related settings in this file, such as the Rserve port. For complete documentation of the settings see

Restart the Tomcat (e.g. with sudo /etc/init.d/tomcat7 restart).

4) Test WPS4R

Open the WPS landing page, select the "wps-js" test client. Then under "Execute Process" select the process org.n52.wps.server.r.test.echo in the dropdown menu. In the appearing menu, enter some words in the input field "InputVariable", select the checkbox next to "OutputVariable". Then click "Execute". In the appearing new section, click the button in the top left corner to refresh the status and inspect the response.

Futher Configuration

Find documentation on how to configure the WPS here:
  • R: You should check the RServe documentation and the recommended security measures. If possible, disable remotes connections.
  • WPS4R: WPS4RDocumentation
    • With a manualbasedir working directory configuration, you have to set the permissions of that directory to chmod 777 or by giving read/write/execute access to the users that run Tomcat and Rserve.
    • ALERT! [currently buggy with processes that return files] With a preset working directory configuration, the WPS4R workdirs are created in /tmp/Rserv/
  • WPS: ConfiguringTheWPS

Installing R Task Views

The R package ctv provides a great way to prepare your WPS4R server for whatever is coming you way with respect to scripts. You can run R as sudo to install the commonly used packages for all users and keep control of the update schedule. However, some packages require specific libraries to be installed which are listed in the following table (as of 2014-06-24).

You can run a sequence of first install.view("") and then update.view("") to install all the required dependencies.
Task view package libraries
Spatial rgeos sudo apt-get install libgeos-dev libgeos-doc
XML sudo apt-get install libxml2-dev
rgdal sudo apt-get install gdal-bin libgdal-dev libproj-dev
ncdf sudo apt-get install netcdf-bin netcdf-doc
rJava sudo R CMD javareconf
rgl sudo apt-get install libglu-mesa-dev
gsl sudo apt-get install gsl-bin libgsl0-dev
tkrplot sudo apt-get install r-cran-tkrplot tcl8.5-dev tk8.5-dev
SpatioTemporal RNetCDF sudo apt-get install libudunits2-dev
rpanel, lgcp http://stackoverflow.com/questions/21729873/r-having-trouble-installing-rpanel
spate sudo apt-get install libfftw3-dev
WebTechnologies (SSOAP) only available on Bioconductor for R 3.1.0
RCurl sudo apt-get install libcurl4-openssl-dev
TimeSeries gmp sudo apt-get install libgmp-dev
SDD needs rpanel (see above)
Rmpfr sudo apt-get install libmpfr-dev
rjags sudo apt-get install jags
cairoDevice needs X11
RGtk2 sudo apt-get install r-cran-rgtk2 libgtk2.0-dev
x12GUI user interface only
Topic revision: r9 - 23 Jul 2014, DanielNuest
Legal Notice | Privacy Statement


This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Wiki? Send feedback