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

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