Skip to content
Steven Kalinke edited this page Apr 21, 2020 · 3 revisions

Install and use RStudio within Windows Subsystem for Linux 2 (WSL 2)


💡 Does WSL 1 work?

No, you will get can not execute binary file: Exec format error when you try to run rstudio command.


Requirements / Limitations

Requirment

  • Windows 10 Pro 18917 or higher (which allows WSL 2)
  • X410
  • Pengwin

WSL 2 and Pengwin Setup

  1. Setup WSL 2 (follow these steps)
  2. Open CMD:
    1. If you have already a distro installed you can see a list and version using wsl -l -v
    2. If you have already a WSL 1 distro installed, you can convert it to WSL 2: wsl --set-version <DistroName> 2. This will take some time.
    3. (You might get prompted to install WSL 2 Linux kernel update. Follow the link and install the msi. Redo step 2)
    4. Make WSL 2 your default: wsl --set-default-version 2
  3. Install Pengwin from Store and launch Terminal
  4. Restart Terminal, you get prompted to do so
  5. After you installed Pengwin, launch it to setup your username/password
  6. Launch pengwin-setup. Select GUI, then GUILIB from the Menu. And wait for the installation to finish
  7. Reopen terminal, and reopen again if prompted (this will apply guilib changes)

Install R and RStudio

  1. Open your WSL2-enabled Distro
  2. sudo apt update (optional)
  3. sudo apt -y upgrade (optional)

Install R

  1. sudo apt -y install r-base
  2. Verify by typing R in your terminal.
  3. R will run an interactive session. Quite with q()

Download/Install RStudio

  1. wget https://download1.rstudio.org/desktop/bionic/amd64/rstudio-1.2.5033-amd64.deb
  2. sudo apt -f install (required to install .deb files)
  3. sudo dpkg -i rstudio-1.2.5033-amd64.deb
  4. If you get an error, try running step 2 again, and then step 3. I don’t know why, but that worked for me, after step 3 initially raised an error.

### Install other GUI dependencies

1. sudo apt install libnss3 2. sudo apt install libegl1-mesa

Restart terminal (twice, if prompted)

These two packages were added in 355a245. You don’t need to install these anymore.

Install X410

  1. Install X410 from the store, then launch it.
  2. Right-click X410 in system tray a click:
    1. Allow Public Access
    2. Windowed Apps (optional)
    3. DPI Scaling → High Quality (optional)

Launch RStudio

Open Pengwin terminal and enter rstudio

Author: @Kalaschnik Steven Kalinke