R Cloud – Deploying RStudio Server

I was updating my desktop RStudio software today, and found its server version on the website. It happens that I have a linux system server (CentOS), why not trying to deploy this server software to make R remotely accessible?

The procedure of deploying RStudio Server is not very complicated, it has four steps according to official guideline:

  1. Install Extra Packages for Enterprise Linux (EPEL);
  2. Install R;
  3. Install RStudio Server;
  4. Configure RStudio Server.

1.Install EPEL

Installing EPEL can make you easier to install R from EPEL. If you are running a RedHat or CentOS system, you have to install EPEL first to ensure RStudio Server works correctly.

Command to install EPEL for different system versions are as follows:

RHEL 5.x / CentOS 5.x

32-bit

$ rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

64-bit

$ rpm -Uvh http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

RHEL 6.x / CentOS 6.x

32-bit

$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

64-bit

$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Then run:

$ yum upgrade

and wait for install completion.

2.Install R

After installing EPEL, you can easily use following code to install R from EPEL:

$ sudo yum install R

3.Install RStudio Server

For RedHat/CentOS (5.4+), code to install RStudio Server is:

32-bit

$ wget http://download2.rstudio.org/rstudio-server-0.98.501-i686.rpm
$ sudo yum install --nogpgcheck rstudio-server-0.98.501-i686.rpm

64-bit

$ wget http://download2.rstudio.org/rstudio-server-0.98.501-x86_64.rpm
$ sudo yum install --nogpgcheck rstudio-server-0.98.501-x86_64.rpm

4.Configure RStudio Server

The default port RStudio Server uses is 8787, so if you type the following code in your browser, you can see the login page now:

http://<server-ip>:8787

20140215-1-1

But you cannot login with your admin root account now, because RStudio Server will not permit logins by system users (those with user ids lower than 100) maybe for security reasons. So we must add a new user now.

Use code:

useradd username -u uid -p password

remember to set uid larger than 100 (larger than 500 is better).

Perhaps you may find you still cannot login with your new account. This is my case and I find a solution to solve it by using RStudio Server group permission setting.

Before set group permission, you have to create two configure files which are not created by RStudio Server by default:

$ touch /etc/rstudio/rserver.conf
$ touch /etc/rstudio/rsession.conf
$ ls

Edit rserver.conf file and add following code:

auth-required-user-group=rstudio_users

in which you can rename “rstudio_users” to whatever you like.

Next reassign the new account to this new user group:

$ groupadd rstudio_users
$ usermod -g rstudio_users -G rstudio_users username
$ rstudio-server restart

After RStudio Server restarted, you will find you can login with the new account. Just enjoy using R on your iPad right now!

There’s one more thing you have to pay attention to. If you are using another computer’s browsers to access the remote R, the recommended minimum versions for various browsers are:

  • Firefox 10;
  • Safari 5.0;
  • Google Chrome 15.

Internet Explorer is not supported originally by RStudio Server, but the RStudio can be run from within Internet Explorer using the Google Chrome Frame browser plugin.

For more information about deploying RStudio Server, please go to RStudio Server Website.