How to Install RStudio in CodeAnywhere server

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 of its features 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 RStudio installed on a server.

Today, I will explain how to Install RStudio Server in CodeAnywhere.

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

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.

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 RStudio:

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.

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.

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

Leave a Reply

Your email address will not be published. Required fields are marked *