How to Install RStudio on the WSL System

Written by noaahhh | Published 2022/03/18
Tech Story Tags: linux | wsl | rstudio | productivity | productivity-tools | productivity-hacks | statistics | programming | web-monetization

TLDRIn this post, I’m going to show you how to install RStudio on the WSL system and to ‘reach over’ the browser. If you are using Windows and don’t want to use the RStudio client on the Windows side, this method will work perfectly. Install Windows-Subsystem For Linux Open the Microsoft Store and search wsl or ubuntu in Windows Store. There are many Windows subsystems for Linux distributions such as Ubuntu, debian, suse, kali, alpine wsl , etc. You can use one of these distributions. Installation can be done using the instructions in the terminal. Determine the username and password for Linux subsystem. You can use windows terminal or any terminal emulator for windows.via the TL;DR App

In this post, I’m going to show you how to install RStudio on the WSL system and to ‘reach over’ the browser.

If you are using Windows and don’t want to use the RStudio client on the Windows side, this method will work perfectly.

Install Windows-Subsystem For Linux

  • Open the Microsoft Store and search wsl or ubuntu in Windows Store.

  • There are many Windows subsystems for Linux distributions such as Ubuntu, debian, suse, kali, alpine wsl , etc. You can use one of these distributions.

  • Installation can be done using the instructions in the terminal.

  • Determine the username and password for Linux subsystem.

  • You can use windows terminal or any terminal emulator for windows.

Note: Graphical Linux application via WSL2 can be used. wsl1 is not supported that. But you must install X window manager to use the graphical application on WSL2. You can use Rstudio desktop on WSL2 in this way.

Install R and RStudio-Server

In this stage, you should install RStudio-server to the subsystem side and you can install the R environment to Linux side as well.

This is absolutely great trick for those switching to windows from Linux. For Ubuntu or Debian:

$ sudo apt-get install r-base
## after the instalation of R environment
$ sudo apt-get install gdebi-core
$ wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-2021.09.2-382-amd64.deb
$ sudo gdebi rstudio-server-2021.09.2-382-amd64.deb

After the installation, You can start the RStudio server via:

$ sudo rstudio-server start

Windows-Side With Browser

R environment and RStudio server have been installed and the server is activated. you can access RStudio from the browser on the Windows side.

RStudio is working on the localhost server and it can be accessed via browser http://localhost:8787 address.

To access the server, you have to have a username and password that has been determined before. You can use the username and password you used during the installation of the subsystem.

Conclusion

Using this method is great for those switching to Windows from Linux. Linux is more simple and more useful but using the Windows OS with the Linux subsystem is quite beneficial.

This method may be used for any environment such as using Python environment and Jupiter notebook together.


This article was first published here


Written by noaahhh | An computer scientist, tech enthusiast, a reader and writer for opensource
Published by HackerNoon on 2022/03/18