Installing and Setting up RStudio Server on Oracle Database Cloud Service (DBaaS)

Version 1

    In this article we will look at how you can allow your developers and data scientists to access the computing capabilities of your Oracle Database Cloud Service (DBaaS). Apart from SQL one of the most popular languages used for analyzing data is the R language. Most people who use this language also use RStudio as their development tool. But the R language has some limitations and your developers and data scientist will quickly encounter them. But as more and more of us are moving to having our data on the cloud, how can we utilize R on our cloud services.


    This article will walk you through the steps on installing and configuring RStudio Server on an Oracle Database Cloud. The newly released 12.2c DBaaS is used in article to illustrate the installation process, but the same steps can be followed for the 12.1c and 11.2g cloud services from Oracle.



    Some of the Oracle DBaaS (12.2c) comes with the R language installed on it. These are the High Performance and the Extreme Performance versions of the DBaaS. TheseDBaaS comes with the Advanced Analytics Option, and the R language is a core component of this option. If you are not using ones of these DBaaS then you will need to have installed the R language before installing RStudio Server.

    Although not required for RStudio Server, you may also want to install Oracle R Enterprise. Although the High Performance and Extreme Performance DBaaS comes with the Advanced Analytics option, what it does’t have is Oracle R Enterprise installed.


    Install RStudio Server

    I have broken the installation of RStudio down into a number of steps. All these steps are specific to the Oracle Database Cloud Service (DBaaS) and the version that I’m using is for version 12.2c of the Database. If you are using one of the earlier versions of the Oracle DBaaS then the following steps should still work.

    1. Download the latest version of RStudio Server.

    The first steps is to download the RStudio Server from their website. To do this I’m using the wget command to download a specific version. You might need to check to see if a more recent version of the tool is available.

    I’m logged into the OPC user of the DBaaS and connected using SSH. The OPC user is the root user of the DBaaS VM.




    The following shows you the output and what you you will see on the screen when you run the above command.


    [opc@trial-12-2-2 ~]$ wget

    --2016-11-12 21:16:23--

    Resolving,,, ...

    Connecting to||:443... connected.

    HTTP request sent, awaiting response... 200 OK

    Length: 38814908 (37M) [application/x-redhat-package-manager]

    Saving to: `rstudio-server-rhel-0.99.892-x86_64.rpm'


    100%[=====================================================================>] 38,814,908  8.75M/s   in 6.8s


    2016-11-12 21:16:33 (5.43 MB/s) - `rstudio-server-rhel-0.99.892-x86_64.rpm' saved [38814908/38814908]


    [opc@trial-12-2-2 ~]$


    The RStudio Server has now been downloaded and uncompressed.


    2. Install RStudio Server

    You are now ready to install RStudio Server. The following command can be used to run the install (while still connected using ssh to the OPC user)


    sudo yum install --nogpgcheck rstudio-server-rhel-0.99.892-x86_64.rpm


    When prompted if it is OK to install, enter y (highlighted in bold below)


    [opc@trial-12-2-2 ~]$ sudo yum install --nogpgcheck rstudio-server-rhel-0.99.892-x86_64.rpm

    Loaded plugins: refresh-packagekit, security

    Setting up Install Process

    Examining rstudio-server-rhel-0.99.892-x86_64.rpm: rstudio-server-0.99.892-1.x86_64

    Marking rstudio-server-rhel-0.99.892-x86_64.rpm to be installed

    public_ol6_UEKR3_latest                                                                 | 1.2 kB     00:00    

    public_ol6_UEKR3_latest/primary |  28 MB     00:13

    public_ol6_UEKR3_latest                                                                                694/694

    public_ol6_latest | 1.4 kB     00:00    

    public_ol6_latest/primary |  60 MB     00:10

    public_ol6_latest 36598/36598

    Resolving Dependencies

    --> Running transaction check

    ---> Package rstudio-server.x86_64 0:0.99.892-1 will be installed

    --> Finished Dependency Resolution


    Dependencies Resolved



    Package                Arch           Version              Repository                                    Size



    rstudio-server         x86_64         0.99.892-1           /rstudio-server-rhel-0.99.892-x86_64         280 M


    Transaction Summary


    Install       1 Package(s)


    Total size: 280 M

    Installed size: 280 M

    Is this ok [y/N]: y

    Downloading Packages:

    Running rpm_check_debug

    Running Transaction Test

    Transaction Test Succeeded

    Running Transaction

    Warning: RPMDB altered outside of yum.

    Installing : rstudio-server-0.99.892-1.x86_64 1/1

    groupadd: group 'rstudio-server' already exists

    rsession: no process killed

    rstudio-server start/running, process 19699

    Verifying  : rstudio-server-0.99.892-1.x86_64 1/1



    rstudio-server.x86_64 0:0.99.892-1



    [opc@trial-12-2-2 ~]$



    The RStudio Server is now installed.


    3. Create a new new OS user for your RStudio work

    Before you can start using RStudio Server, you will need to create a new operating system/linux user. This user will be used to connect into or log into RStudio Server as it requires and OS level username and password.


    While still ssh connected to the OPC user, run the following command to create a new RSTUDIO linux user.


    [opc@trial-12-2-2 ~]$ sudo adduser rstudio



    Now set the password for the RSTUIO linux user. This needs to be a strong password of letters, characters and special characters.


    [opc@trial-12-2-2 ~]$ sudo passwd rstudio

    Changing password for user rstudio.

    New password:

    Retype new password:
    passwd: all authentication tokens updated successfully.
    [opc@trial-12-2-2 ~]$


    After creating the user you might want to define specific privileges and access to to certain parts of your DBaaS server, as you don’t want them to run wild on your database server.


    4. Open ports for RStudio on your DBaaS.

    RStudio Server runs on port 8787. You will need to open this port on your Cloud Service. To do this you need to go to the Access Rules for your Cloud Service and click on the Create Run button on the top right hand side of the screen.



    In the Create Access Rule window you can specify the description details, the source for the rule (PUBLIC-INTERNET), the destination (DB), the port (8787) and the Protocol (TCP).

    When you click on the Create button the rule will be saved and enabled.


    5. Open RStudio using a web browser.

    Open your favorite web browser and put in the host name or the IP address of your Oracle DBaaS. This should be followed by the port number for RStudio, for example


    You should then get the login screen for RStudio.




    Log in using your RSTUDIO linux username and password that you created earlier.  Assuming everything has been entered correctly the you should have the following being displayed. You are now using RStudio Server on your DBaaS and can not start using the processing capabilities of the DBaaS instead of your local machine.




    Some Additional RStudio Settings required to work with Oracle Database and ORE

    The Oracle DBaaS (12.2c) comes with the R language installed on it. This is assuming you are using the version of the DBaaS that comes with the Advanced Analytics Option. If you are not using ones of these then you will need to have installed the R language before installing RStudio Server.

    In theory if you have just installed ORE and then RStudio Server, everything should work, but if you encounter any issues then check out the following.

    1. Edit the rserver.conf files

    Add in the values and locations for RHOME and ORACLE_HOME

    sudo vi /etc/rstudio/rserver.conf    



    2. Edit the .Renviron file.

    Add in the values for ORACLE_HOME, ORACLE_HOSTNAME and ORACLE_SID

    cd /home/oracle sudo vi .Renviron    




    You are all done now with all the installations and configurations.