R studio server in wsl


I have installed CL on wsl2 (windows 10), and I have been trying to run R-studio-server.

When I did

sudo rstudio-server start

I get the following message

sudo: rstudio-server: command not found

My question is …

Is it possible to run rstudio-server in this environment? (if I remember correctly, rstudio-server was running fine with Ubuntu on wsl2.


  • R-basic, R-datasets, R-extras, R-rstudio, R-rstudio-server, R-stan are all installed
  • rstudio seems to be installed as I get the following error “qt.qpa.xcb: could not connect to display”, which I can understand as wsl2 does not support gui apps with Windows 10.

Thank you very much for your input in advance!

rstudio-server is not a valid command on clear linux, however the following commands are valid.

sudo systemctl start rstudio-server.service
sudo rstudio

i am not familiar with wsl or rstudio, but i beleive rstudio requires xorg. (qt.qpa.xcb: could not connect to display)

1 Like

Thank you very much for your comment.

sudo systemctl start rstudio-server.service

Gives me

System has not been booted with systemd as init system (PID 1). Can't operate. 
Failed to connect to bus: Host is down

It seems like wsl2 does not have systemctl. I am trying to find a way to get around it, but without a success…

Again, thank you very much for your time to answer my question.

cat /usr/lib/systemd/system/rstudio-server.service gives:

Description=RStudio Server

ExecStop=/usr/bin/killall -TERM rserver


i dont know how the wsl file hierarchy works, but it seems that you need to execute what would normally be /usr/lib64/R/rstudio-server/bin/rserver
there is also an executable /usr/lib64/R/rstudio-server/bin/rstudio-server

1 Like

it seems what you are looking for is /usr/lib64/R/rstudio-server/bin/rstudio-server
to get the command rstudio-server, execute the following

export PATH=$PATH:/usr/lib64/R/rstudio-server/bin/
echo 'export PATH=$PATH:/usr/lib64/R/rstudio-server/bin/'>>~/.bashrc

for fish:

set -Ux PATH $PATH  /usr/lib64/R/rstudio-server/bin/

you can also execute it directly with the full path name


rstudio-server is a bash script. i looked at it, and it seems you might need either sytemd or initctl to run it. perhaps use rserver instead.

Thanks a lot. Your suggested command gives me the following error

/usr/lib64/R/rstudio-server/bin/rstudio-server: line 12: etc/init.d/rstudio-server: No such file or directory

I was looking at the file /lib64/R/rstudio-server/bin/rstudio-server:

As you mentioned, I need either systemd or initctl, which I think I don’t have it on linux with wsl2…

Regarding Rstudio (on wsl2),

I was able to turn on GUI following the instruction from (“To run Gnome desktop on Clear Linux”)
Run any Linux distribution on WSL - Case: Clear Linux OS and its Gnome desktop - Technically Impossible (hatenablog.jp)

Then, the following command opened the Rstudio

sudo rstudio

I still don’t know how to run rstudio-server. But, this is good enough for me at this moment.

did you try rserver ?
rserver should enable you to open rstudio from your browser


  1. Boot CL on WSL, then type following command.

  2. Run web browser on Windows (WSL host), access localhost:8787.
    The browser will show RStudio GUI.

And I would like to add 3 things.

  1. Although WSL doesn’t have systemd, it is not problem for RStudio server. Actually, the official support ignore it.
    [https://support.rstudio.com/hc/en-us/articles/360049776974-Using-RStudio-Server-in-Windows-WSL2]( Using RStudio Server in Windows WSL2)

  2. X is not required for RStudio server, because RStudio GUI is provided through web browser like this.

  3. If you have no special reason, I recommend Ubuntu on WSL, not CL. And install with apt packages provided by rstudio.org as the official support mentions above. They always provide latest and stable version of RStudio.

Thank you very much to all. You guys are awesome. Let me close this thread by summarizing what I did below for those who do not know nothing about Linux but who want to check out and use Rstudio in CL on wsl2:

There are at least two ways to run Rstudio (wsl2 on Windows 10)

(Method 1) Rstudio-server:


Then, on your browser (on Windows), go to


Then, Rstudio will appear on your browser.

(Method 2) Running Rstudio via X11 forwarding:

I was able to turn on GUI following the instruction from (“To run Gnome desktop on Clear Linux”):
Run any Linux distribution on WSL - Case: Clear Linux OS and its Gnome desktop - Technically Impossible (hatenablog.jp)

Then, the following command will open Rstudio

sudo rstudio

Final comments
Of course, you can always use Rscript to run your script from the command line.

From my limited experience,

  • Running R on WSL2-Ubuntu was faster than running R on WSL2-CL. For R on WSL2-Ubuntu, I did something to use openblas in R. For R on WSL2-CL, I just used it out of box as it already offers R with openblas.
  • This is based on two experiments.
    One with the R benchmarking script from (version 2.5): R benchmarks (r-project.org)
    Another with my personal Rpackage that heavily relies on Rcpp and Rcpparmadillo.
  • Tested with Intel i9-10980xe at 3.0ghz with 48Gb memory

Hi, that is my blog.
By the way, why don’t you use Windows version?
It is the easiest and simplest way.

Oh I see. Thanks for writing that blog post!

To answer your question. There are several reasons:
(1) I am developing several R packages (using machines running on Windows and OSX). I wanted to see how these packages would behave on Linux.
(2) I am trying to learn Linux a little by little by myself. I’d love to move away from Windows at some point in the future (probably, it is not going to happen in the near future, though …). I thought that WSL2 was good for this goal as I can try several distros to get some feeling about them.

1 Like

About OpenBLAS performance, I too experienced it being faster on Ubuntu Linux versus Clear Linux. I’m not sure if isolated to running on an AMD box.

I see. I thought that WSL was a contributing factor for this. But, it seems that it may not be just me and my machine. In any case, I am too novice to tell what is going on and how to make it better. In any case, it has been fun experience playing around with multiple Linux distros.

I might be able to compare performance of my Julia code across different platforms in couple of weeks. I will keep you all posted.