Using RStudio Server in Windows WSL2


Note: This article uses the open-source RStudio Server version. We do not support RStudio professional products on WSL. This article is intended for a single-user of the open source RStudio Server edition. It is not intended for a multi-user deployment.

Author: JooYoung Seo

Table of Contents


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

As RStudio Server has primarily been designed to work with Linux distributions, Windows users require a virtualization technology, called “Windows Subsystem for Linux” (WSL), to run a Linux kernel inside their system.


We recommend using the enhanced WSL (version 2) for setting up RStudio Server, 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.

WSL Setup

Once you have met the prerequisite, you need to enable WSL features on your system.

  1. Open “Windows PowerShell” with admin privileges.

  2. Turn on the WSL feature using the following command in the PowerShell:

    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
  3. Enable the “Virtual Machine Platform” feature by running the following command in the PowerShell:

    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  4. Restart your system.

  5. Open “Windows PowerShell” with admin privileges again.

  6. Set WSL 2 as your default version using the following command in the PowerShell:

    wsl --set-default-version 2
  7. Download and install the latest WSL2 Linux kernel if you see the following message:

    WSL 2 requires an update to its kernel component. For information please visit

Linux Distribution Setup

After the WSL 2 feature has been enabled, you have to download and install a Linux distribution from Microsoft Store.

While RStudio Server does support other distros, details in this article will be specific to Ubuntu 20.04.

You can download and manually install the distro by clicking the link below:

Once the distribution has been installed and launched, you will be prompted for the initial user configuration like below:

Installing, this may take a few minutes…

Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit:

Enter new UNIX username:

Provide a user name followed by password that will be used for both your WSL distribution and RStudio Server authentication later on.

You can now close the WSL instance by typing the following command:

  • Note: Unlike the PowerShell, you cannot use Ctrl + V shortcut key to paste the clipboard content into the WSL terminal. Alternatively, press mouse right-click button to emulate the paste function.

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:

  1. Press Windows logo key to open start menu, then type wsl to launch your installed Linux distro.

  2. 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.
  3. 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 --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
    sudo add-apt-repository 'deb focal-cran40/'
    • Note: More detailed information on installing the latest R for Linux can be found at the official CRAN page.
  4. 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
  5. Install latest stable release of RStudio Server for Ubuntu 18 or newer:

    sudo gdebi rstudio-server-latest-amd64.deb
    • Note1: 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.

    • Note2: See the RStudio Release page for full list of supported platforms. Make sure you choose RStudio Server (not Desktop) and match with your installed Linux distribution type and version.

    • Note3: While we recommend installing the current stable release, you may evaluate pre-release versions by consulting their download pages at RStudio Preview or RStudio Daily.

  6. Launch RStudio Server:

    sudo rstudio-server start
    • Note1: If there was no error message, you can assume that your RStudio Server has been successfully loaded.

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

  7. Access your server at http://localhost:8787.

    • Note: 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:

  1. Press Windows logo key to open start menu, then type wsl to launch your installed Linux distro.

  2. To stop RStudio Server, type the following command in the WSL terminal:

    sudo rstudio-server stop
    • 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.
  3. Remove your Server:

    sudo apt-get remove rstudio-server -y

Upgrading RStudio Server

More information on how to upgrade RStudio Server can be found at this article.