As outlined in the first blog, we will now install R and Rserve on the HCP Virtual Machine.

Note: The scenario described in this blog is for testing and evaluation purposes only. It is done with a root user which should not be used for productive purposes. For productive scenarios, follow the official R Installation and Administration documentation.

Install R

Step Screenshot

To install R for SAP HANA, you must compile the R package from its source code.

1. Execute

zypper addrepo -f https://slesrepo.hana.ondemand.com/repo/SUSE/Products/SLE-SERVER/12/x86_64/product/ SUSE12

2. Execute
zypper addrepo -f https://slesrepo.hana.ondemand.com/repo/SUSE/Products/SLE-SDK/12/x86_64/product/ SUSE12SDKThe steps 1-2 are performed so that we can have the repositories required to install R.
 
3. Execute “zypper repos” to list all the added repositories.  

4. Executezypper install gcc gcc-c++ gcc-fortran

This command will Install the dependencies required for compiling R.

 

5. Press “1” and enter.When you execute the above step there are some versioning issue with gcc-fortran, to continue the installation you are provided with some solution.

This step is done to downgrade the version by pressing the number of the solution as shown in the figure.

 
6. Press “y” and enter.
This will retrieve the packages and install them.
 

7. Execute the command to download R source package.wget http://ftp.iitm.ac.in/cran/src/base/R-2/R-2.15.0.tar.gz

Note: For information about supported versions of R and Rserve, see SAP HANA and R compatibility and support.

 
8. Extract the tar.gz file with the command tar zxf R-2.15.0.tar.gz.  
9. Execute ls
10. Execute cd R-2.15.0/ to change directory
11. Execute
./configure –enable-R-shlib –with-readline=no –with-x=no
 
12. Execute “make clean” to compile R.  
13. Execute make
Note: This step might take some time.
 
14. Execute make install  
15. Execute “R” to check if R has been installed.
You should see the following output.
 
16. Execute q() to exit from R.
When prompted to Save workspace image: Press “n” and Enter.
 

Summary: You have built R from source and installed it on the virtual machine.


Install and configure Rserve
As a next step, we will install and configure Rserve which is a TCP/IP server which allows other programs to use facilities of R. 

Step Screenshot
1. Execute command to download the Rserve package:
wget http://cran.rstudio.com/src/contrib/Rserve_1.7-3.tar.gz
 

2. Execute R.

3. Execute “install.packages(“Rserve_1.7-3.tar.gz”, repos = NULL)”
to install the package.

 
4. Execute library(“Rserve”)
Note: Successful installation should return no output
 
5. Execute q()
6. When prompted to Save Workspace image. Press “n” and then press  the Enter key.
 

7. Execute vi /etc/Rserv.confFollow the steps below to insert and save the entry.

Press I

Type remote enable

Press the keys in the following order Esc<space>:wq!

 
8. Execute useradd –m ruser to create a user.  
9. Execute passwd ruser to set the password to ruser  
10. Login as ruser by executing su –l ruser  

11. Execute

R CMD Rserve –RS-port 4000 –no-save –RS-encoding “utf8”

Once this is executed, Rserve has started in daemon mode.

Note: The port that you will provide here is the one that you will create in next exercise “Enabling Communication to Virtual Machine”

 

12. Execute telnet localhost 4000

Note: This command will test whether Rserve is running or not.

 

Summary: You have installed Rserve in your VM and successfully started it in daemon mode.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply