3.1.7.1 Configuration

This section describes about how to configure R interpreter.

To configure R interpreter, follow these steps:
  1. Navigate to the <COMPLIANCE_STUDIO_INSTALLATION_PATH>/deployed/mmg-home/mmg-studio/conf directory.
  2. To configure Rserve, execute the following.
    nano /scratch/software/R/Rserve.conf (sample file)
    >
    auth required
    plaintext disabled
    pwdfile /scratch/software/R/creds/Rserve.pwd
    remote enable
    switch.qap.tls enable
    tls.port 6311
    qap disable
    interactive no
    rsa.key /scratch/software/R/creds/server.key
    tls.key /scratch/software/R/creds/server.key
    tls.cert /scratch/software/R/creds/server.crt
  3. Create a password file (Rserve.pwd) using the following.
    >
    oml $5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8

    The file contains one line per user, where the first part is the username, and the second part is the password. The password can either be plain text or a MD5/SHA1 hash. In this example the password `password` is hashed with SHA1.If you use hashed passwords, the password string needs to start with a `$` sign.

  4. To generate the SSL key, execute the following.
    openssl genrsa -out server.key 2048
    openssl req -new -key server.key -out server.csr # password 1234
    openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
  5. To generate a keystore file, execute the following.
    keytool -import -alias <keystore-alias> -file <path-to-server.crt>/server.crt -keystore <output-path-to-keystore/rinterpreterkeystore -storepass <keystore-secret> -noprompt
    For example,
    keytool -import -alias <rserve -file> <COMPLIANCE_STUDIO_INSTALLATION_PATH>/deployed/mmg-home/mmg-studio/conf/Rserver.crt -keystore <COMPLIANCE_STUDIO_INSTALLATION_PATH>/deployed/mmg-home/mmg-studio/conf/rinterpreterkeystore -storepass changeit -noprompt
    After execution, the following files are generated in the <COMPLIANCE_STUDIO_INSTALLATION_PATH>/deployed/mmg-home/mmg-studio/conf directory.
    • rinterpreterkeystore
    • Rserve.conf
    • Rserve.pwd
    • Rserver.crt
    • Rserver.csr
    • Rserver.key

    Figure 3-30 R Interpreter Files



  6. Open the Rserve.conf file and update the following:

    Table 3-6 Rserve.conf File

    Parameter Value
    rsa.key <COMPLIANCE_STUDIO_INSTALLATION_PATH>/deployed/mmg-home/mmg-studio/conf/Rserver.key
    tls.key <COMPLIANCE_STUDIO_INSTALLATION_PATH>/deployed/mmg-home/mmg-studio/conf/Rserver.key
    tls.cert <COMPLIANCE_STUDIO_INSTALLATION_PATH>/deployed/mmg-home/mmg-studio/conf/Rserver.crt
    maxbufsize 1000000004 in bytes
  7. Navigate to the <COMPLIANCE_STUDIO_INSTALLATION_PATH>/bin directory.
  8. Open config.sh file and update the following parameters:
    1. R_ENABLED=true
    2. RS_CONF_PATH=<COMPLIANCE_STUDIO_INSTALLATION_PATH>/mmg-home/mmg-studio/conf/Rserver.conf
    3. RS_KEYSTORE=<COMPLIANCE_STUDIO_INSTALLATION_PATH>/mmg-home/mmg-studio/conf/rinterpreterkeystore
    4. RS_KS_SECRET=changeit
  9. Run Compliance Studio. To run, execute the following command.
    ./compliance-studio.sh --update
  10. Restart Compliance Studio. The R interpreter will be visible in the UI and you can execute the R paragraph.
  11. Navigate to the <COMPLIANCE_STUDIO_INSTALLATION_PATH>/deployed/mmg-home/bin directory.
  12. Open config.sh file and validate the following parameters:
    1. R_ENABLED=true
    2. RS_CONF_PATH=<COMPLIANCE_STUDIO_INSTALLATION_PATH>/deployed/mmg-home/mmg-studio/conf/Rserver.conf
    3. RS_KEYSTORE=<COMPLIANCE_STUDIO_INSTALLATION_PATH>/deployed/mmg-home/mmg-studio/conf/rinterpreterkeystore
    4. RS_KS_SECRET=changeit
  13. Navigate to the <COMPLIANCE_STUDIO_INSTALLATION_PATH>/mmg-home/bin directory.
  14. Open config.sh file and validate the following parameters:
    1. R_ENABLED=true
    2. RS_CONF_PATH=<COMPLIANCE_STUDIO_INSTALLATION_PATH>/mmg-home/mmg-studio/conf/Rserver.conf
    3. RS_KEYSTORE=<COMPLIANCE_STUDIO_INSTALLATION_PATH>/mmg-home/mmg-studio/conf/rinterpreterkeystore
    4. RS_KS_SECRET=changeit
If users get an SSL error while executing the R interpreter, follow these steps:
  1. Log in to the Linux server as root and change to the /etc/yum.repos.d directory.
  2. Download Rserve_1.8-10.tar.gz.
  3. Install openssl-devel - yum install openssl-devel
  4. To install, execute the following.
    R CMD INSTALL --configure-args="--with-ssl-headers=/usr/include --with-ssl-libraries=/usr/lib64" Rserve_1.8-10.tar.gz

    The following steps can be executed from R session to check that rserve configuration is working before starting the services.

  5. Open the Putty and enter R -version.
  6. Execute the following command.
    1. library(Rserve)
    2. Rserve(args="--RS-conf <COMPLIANCE_STUDIO_INSTALLATION_PATH>/deployed/mmg-home/mmg-studio/conf/Rserve.conf --no-save")
  7. After verifying, stop Rserve and ensure the port is free.
  8. Navigate to the <COMPLIANCE_STUDIO_INSTALLATION_PATH>/bin directory.
  9. Restart Compliance Studio.
  10. Navigate to the interpreter notebook and run the R paragraph to validate the output.