Boost Your R Programming Environment

Bhagesh Hunakunti
3 min readOct 20, 2020

RStudio server on Windows WSL2 which now supports GPU compute.

I present to you a super-easy guide for setting up and running RStudio Server for Ubuntu 20 on Windows 10. This is useful if you want to run R for Linux (e.g., due to its faster computation and better parallelization or simply to do cross-platform development) while on a Windows machine.

At Build 2020 Microsoft announced support for GPU compute on Windows Subsystem for Linux 2. I mean How cool is that?

This article explains how to set up RStudio Server on Windows platform.

Prerequisite

Using the enhanced WSL (version 2) for setting up RStudio Server is recommended, which requires Windows 10 (Version 2004; Build 19041 or higher).

  1. You can check your Windows version by pressing the Windows logo key + R, type winver, and hit enter.
  2. In case your system is lower than the suggested version, please update to the latest Windows version.
  3. Lucky for you’ll I have a video linked below which explains installation of WSL2 in 5 minutes.

Installing Your Favourite Linux Distribution

How to install Ubuntu on windows (wsl2)

RStudio Server Setup

Now that you have successfully installed a Linux distribution on your system via WSL, you can setup and run RStudio Server by following the procedures below:

  • Press Windows logo key to open start menu, then type wsl to launch your installed Linux distro.
  • Make sure your Linux packages are up-to-date using the following command (we will assume that you have installed a Ubuntu distribution): sudo apt-get update sudo apt-get upgrade -y Note: Provide the password of your user account that you created for the Linux system, not the Windows password to log in for your PC.
  • Add the following apt credential to your repository list for Getting the Latest R (v4.0.1 as of this writing):sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 sudo add-apt-repository 'deb https://cloud.r project.org/bin/Linux/ubuntu focal-cran40/'
  • Install R with some essential dependencies for the RStudio Server and devtools: sudo apt install -y r-base r-base-core r-recommended r-base-dev gdebi-core build-essential libcurl4-gnutls-dev libxml2-dev libssl-dev
  • Install latest stable release of RStudio Server for Ubuntu 18 or newer:wget https://rstudio.org/download/latest/stable/server/bionic/rstudio-server-latest-amd64.deb sudo gdebi rstudio-server-latest-amd64.deb

Note : You may receive a warning message like “Couldn’t find an alternative telinit implementation to spawn.” This is a known issue and can be safely ignored.

Launching Rstudio Server in Browser

  1. Launch RStudio Server: sudo rstudio-server start
  2. Access your server at http://localhost:8787

Note 1: If there was no error message, you can assume that your RStudio Server has been successfully loaded.

Note 2: If you terminate and restart WSL, you will need to run sudo rstudio-server start again to get RStudio Server up and running.

Note 3: The user name and password are the same as your Linux system’s.

Removing RStudio Server

The following steps explain how to uninstall RStudio Server from WSL:

  • To stop RStudio Server, type the following command in the WSL terminal:sudo rstudio-server stop
  • Remove your Server:sudo apt-get remove rstudio-server -y

--

--

Bhagesh Hunakunti

Pursuing Masters in Bioinformatics, Digital artist and content creator. Contact: https://linktr.ee/BhageshCodebeast