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.
Using the enhanced WSL (version 2) for setting up RStudio Server is recommended, which requires Windows 10 (Version 2004; Build 19041 or higher).
- You can check your Windows version by pressing the
Windows logo key + R, type
winver, and hit enter.
- In case your system is lower than the suggested version, please update to the latest Windows version.
- Lucky for you’ll I have a video linked below which explains installation of WSL2 in 5 minutes.
Installing Your Favourite Linux Distribution
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:
Windowslogo key to open start menu, then type
wslto 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 -yNote: 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
- Launch RStudio Server:
sudo rstudio-server start
- 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
Check-out my YouTube channel for more amazing contents like this.