How to Install RStudio in CodeAnywhere Server Easily

By | July 13, 2019

CodeAnywhere is a cloud based development platform that enables developers to develop their app on the cloud, with interface available both for desktop and mobile. One might wonder if it is possible to install software such as Rstudio in CodeAnywhere server.

One of the features of CodeAnywhere is the ability to deploy container, which is basically a Linux virtual server built with specific coding environment for example PHP, Java, Go, and others.

One of the available option is to deploy “Blank” container which is a Linux virtual server with root access, available to be installed with anything.

As user of R, I wish to have the statistic software available anywhere, luckily there is a RStudio Server which is a browser interface for the statistic software package installed on a server.

Today, I will explain how to Install RStudio Server in CodeAnywhere, so you can access the popular statistical analysis software anywhere you go.

First is to open up the CodeAnywhere and create a blank container by going File -> New Connection -> Container

codeanyhere-connection-wizard

Choose either Ubuntu or CentOS and name it as you wish, for example “rstudio”, in this example we will use Ubuntu.

Then, right click on the container name, and choose “SSH Terminal” to launch shell interface and start the installation of the RStudio Server.

codeanywhere-ssh-terminal

First, we need to create a new user for the rstudio, set a password, and change permission for its home directory:

 sudo useradd rstudio
 sudo mkdir /home/rstudio
 sudo passwd rstudio
 sudo chmod -R 0777 /home/rstudio

Then we need to make sure the installed package are updated with the latest and install necessary packages:

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install r-base libapparmor1 gdebi-core

Choose yes for installation of all required packages.
Then, we can start installing the package by running the following commands:

wget https://download2.rstudio.org/server/trusty/amd64/rstudio-server-1.2.1335-amd64.deb
sudo gdebi rstudio-server-1.2.1335-amd64.deb

After successful installation, we can see that the RStudio Server service is already running, as shown as in the image below.

codeanywhere-rstudio-server

Then, we can go access it through web browser using this URL:

http://port-8787.[container name]-[codeanywhere username].codeanyapp.com

Then we will be given the login page of the RStudio which we can use the previously created user account.

rstudio-codeanywhere-interface

References
https://cran.r-project.org/bin/linux/ubuntu/
https://rstudio.com/products/rstudio/download-server/