Install R Studio Server on Windows

20,849

Solution 1

Install Virtual Box from here. Then get Ubuntu Server and add the iso to the virtual machine. Manage to make the Ubuntu to access the network and install RStudio Server.

That's it! Go on windows open the brower and type http://ipAddressOfUbuntu:8787/.

Solution 2

Here are the steps I took to solve this. My setup is a Windows 10 Pro on a LAN ("host computer"). My goal is to have rstudio-server running on a ubuntu virtual machine ("guest computer", running on the windows computer, and accessible to another computer on the LAN ("remote computer").

  • Install oracle virtualbox (https://www.virtualbox.org/wiki/Downloads).
  • Set up virtualbox to run Ubuntu Server (desktop also works; details available elsewhere online - you may have to troubleshoot this, in my case, I had to disable Windows Hyper-V to get virtualbox to work).
  • Install r and rstudio-server on the virtualbox Ubuntu (details available elsewhere online).
  • Activate Windows ssh and openssh. Since I believe 2018, Windows 10 has openssh client and server built-in, but it needs to be activated. Details here: https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse
  • On the Ubuntu virtualbox, run ifconfig on the terminal, find the ip address after inet. Mine was 10.0.2.15.
  • In the settings for the Ubuntu virtualbox, go to Network > Advanced. Add a rule: Host IP = 127.0.1.1; Host Port = 22; Guest IP = (what you got earlier, recall mine was 10.0.2.15); Guest Port = 22. This is so we can ssh into the guest Ubuntu from the Windows host.
  • In the Windows (host) command prompt, forward 8787 from the guest, which is on 127.0.1.1 (due to the previous step), to the host 8787. That is, run ssh -N -L 8787:localhost:8787 [email protected], where username is the name of the user on the guest (ubuntu virtualbox).
  • Now on the Windows host you should be able to go to localhost:8787 and access rstudio-server on the guest ubuntu (test this now).
  • Since openssh is running on Windows, you can now forward 8787 from a remote computer to the Windows host. To do this, first, install the ssh client on the remote computer. Then find the ip address of the Windows host on the LAN by e.g. running ipconfig on the command prompt of the Windows host computer, or looking at the router admin page. Then on the remote computer, do ssh -N -L 8787:localhost:8787 username@windowshostip, where username is your windows login. Then go to localhost:8787 on the remote computer. You should now be able to access rstudio-server on the Ubuntu guest OS running on virtualbox on the Windows host.

In principle this can be generalized to beyond LAN, if the router forwards incoming port 22 to the ip address of the windows computer to the windows computer (most routers won't do this by default, I think).

Also this should work on a MacOS as well, since both virtualbox and openssh are available there (have not tried).

Share:
20,849
user1665355
Author by

user1665355

Updated on July 29, 2020

Comments

  • user1665355
    user1665355 almost 4 years

    Is it possible to install RStudio Server on a Windows machine? I know that it is possible if I use AMI, but how could I install it without AMI?

    I've read at http://www.r-bloggers.com/rstudio-server-part-2-pros-of-using-rstudio-server-for-a-remote-connection/ that:

    "This is mainly a problem under Windows, where you need to install Cygwin to get the X server running (assuming using putty for the ssh connection). Although it works, I don’t really like installing a lot of additional software just to get a remote connection with graphic support."

    But I dont get it... Any ideas?

    • Michele
      Michele almost 11 years
      what about a virtual machine installed on your windows PC running say, Ubuntu Server?
    • user1665355
      user1665355 almost 11 years
      @Michele ok! Have to check out Ubuntu server. Could I then acess Rstudio server on any computer through a webbrowser? What do I do after I install Ubuntu Server?
  • user1665355
    user1665355 almost 11 years
    Thanks! How do you mean "add the iso"?
  • Michele
    Michele almost 11 years
    oh yeah, once you have installed Virtual Box it will ask you to add a new machine, which you will need to configure (like to set the number of cores and amount of ram it can use). Finally you'll need to add the path of the "installer" which can be either your physical or virtual DVD drive (where the .iso file is mounted). Is it clear?
  • user1665355
    user1665355 almost 11 years
    Yeah! Thanks! One last question, maybe a stupid one... Will I be able to open R studio server on any computer with the correct http adress?:)
  • Michele
    Michele almost 11 years
    @user1665355 From any conputer inside the domestic/office network.
  • user1665355
    user1665355 almost 11 years
    So if I understand correctly, if I use your suggested approach I can access from the domestic/office network. But if I use AMI I can reach R studio on any computer?
  • Michele
    Michele almost 11 years
    Yes I think so, Amazon will store (and run) the server "for you" so I can't see why it shouldn't be possible.
  • RockScience
    RockScience almost 7 years
    but then will this RStudio instance have access to the SQL database and path using the windows domain?