Install WPS4R on Debian
This tutorial shows the steps to install
WPS4R on a Linux server, including R.
Prerequisites
Installation steps
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.
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.
- [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 |