RStudio Server on CentOS 7 x84_64

Hi All,

I have configured RStudio Server 1.0.153 on CentOS. R version 3.4.1 is already installed. However, I am not able to access RStudio Server via Chrome browser.

What I tried:

  1. rstudio-server verify-installation doesn't through any error or any message and successfully comes back to shell after verifying whatever it has to.

  2. rstudio-server status shows following log for active session:

    rstudio-server status
    ● rstudio-server.service - RStudio Server
    Loaded: loaded (/etc/systemd/system/rstudio-server.service; enabled; vendor preset: disabled)
    Active: active (running) since Sat 2017-10-21 15:09:21 MST; 2min 26s ago
    Process: 159696 ExecStop=/usr/bin/killall -TERM rserver (code=exited, status=0/SUCCESS)
    Process: 159785 ExecStart=/usr/lib/rstudio-server/bin/rserver (code=exited, status=0/SUCCESS)
    Main PID: 159787 (rserver)
    CGroup: /system.slice/rstudio-server.service
    └─159787 /usr/lib/rstudio-server/bin/rserver
    Oct 21 15:09:21 localhost.localdomain systemd[1]: Starting RStudio Server...
    Oct 21 15:09:21 localhost.localdomain systemd[1]: Started RStudio Server.

  3. For some reason, after above command when I run rstudio-server restart, I get following output:

    rsession: no process found

  4. I ran following command to verify install further, however still no output or log generated on system:

    sudo rstudio-server stop
    sudo /usr/lib/rstudio-server/bin/rserver --server-daemonize=0

  5. R is installed using repo and path is /usr/bin/R

  6. On browser, I type: IP:8787, but I get page can't be reached error.

I am using VPN to access RStudio Server, is that not possible? Ideally, it should be possible, given RStudio Server will be used mostly in enterprise using VPN. Any specific firewall settings I need to do?

Please suggestion solutions.

Thanks.

Hi @chetanpatil, other than port 8787 to be open, there are no other network/port requirements for RStudio Server. As long as rstudio-server status comes back with Active: active(running) then you should be able to access the server via a browser.

Hi @edgararuiz,

I tried accessing RStudio Server after logging from same network as that of server but still can't get it to work. With or without VPN, same issue.

Port 8787 is open. What else can I try? Can you replicate this on your system with CentOS?

netstat -nat | grep LISTEN
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:8787            0.0.0.0:*               LISTEN
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN
tcp6       0      0 :::111                  :::*                    LISTEN
tcp6       0      0 :::22                   :::*                    LISTEN
tcp6       0      0 ::1:631                 :::*                    LISTEN
tcp6       0      0 ::1:25                  :::*                    LISTEN

Thanks.

Ok, can you confirm that R works when you start a session in a terminal? Just R, w/o RStudio

Hi @edgararuiz,

Yes, R works:

~$ R

R version 3.4.1 (2017-06-30) -- "Single Candle"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> print("I Work")
[1] "I Work"

Thanks.

Ok, can you read through this interchange and see if there's anything you can try out? https://support.rstudio.com/hc/en-us/community/posts/200669097-rstudio-server-and-port-8787-wont-respond

Hi @edgararuiz,

I tried following:

  1. sudo ufw allow 8787 from above link you shared and the running sudo ufw status gives port 8787 as active. But RStudio Server is still not accessible.

    Status: active
    
    To                         Action      From
    --                         ------      ----
    SSH                        ALLOW       Anywhere
    224.0.0.251 mDNS           ALLOW       Anywhere
    8787                       ALLOW       Anywhere
    SSH (v6)                   ALLOW       Anywhere (v6)
    ff02::fb mDNS              ALLOW       Anywhere (v6)
    8787 (v6)                  ALLOW       Anywhere (v6)
    
  2. Few more system queries related to network port on CentOS 7 and all queries point that network configuration is correct:

     ~$ sudo systemctl status firewalld
     ● firewalld.service - firewalld - dynamic firewall daemon
    Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
    Active: active (running) since Sat 2017-10-21 20:38:02 MST; 35min ago
      Docs: man:firewalld(1)
      Main PID: 2987 (firewalld)
    CGroup: /system.slice/firewalld.service
            └─2987 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
    
    ~$ sudo firewall-cmd --zone=public --add-port=8787/tcp
    Warning: ALREADY_ENABLED: '8787:tcp' already in 'public'
    success
    
    ~$ sudo firewall-cmd --reload
    success
    
    ~$ sudo firewall-cmd --zone=public --list-all
    public (active)
    target: default
    icmp-block-inversion: no
    interfaces: enp4s0f1
    sources:
    services: dhcpv6-client ssh
    ports: 8787/tcp
    protocols:
    masquerade: no
    forward-ports:
    source-ports:
    icmp-blocks:
    rich rules:
    

Any thing else I can try to get this to work?

Thanks.

Hi @edgararuiz,

Update 1

Running wget localhost:8787 gives me following HTML file on the server where I have RStudio Server configured. Is this the issue?

html

I have Firefox on the server and the browser Chrome (used to access RStudio Server) version on my PC is latest too.

firefox --version
Mozilla Firefox 52.4.0

Update 2

However, when I run wget server-ip:8787, then I get following connection refused:

--2017-10-23 14:04:39--  http://<server-ip>:8787/
Connecting to <server-ip>:8787... failed: Connection refused.

Thanks.

That response is just because wget isn't a supported "browser". It does indicate that RStudio Server is running and responding to that port, however.

If you are familiar with ssh tunneling, you may want to try forwarding the server 8787 port to your local PC and see if you can access the server that way. If that works, it is either a firewall/server networking issue, or something in your work network (a proxy server or some kind of IP filtering between you and the server).

Edit: Just saw your edit; that sounds like a firewall issue somehow, given that previous troubleshooting showed that the server was listening to all IPs (0.0.0.0).

Hi @nick,

If you refer to previous posts on this thread, firewall queries show that port is open and allowed. Anything specific I can try related to firewall?

Thanks.

Yeah, I saw that firewall information, but I don't know enough about firewalld to know about other potential problems. Can you temporarily disable the firewall completely and see if that works?

Hi @nick,

Ever after disabling firewalld, ufw and SELinux (by default was not enabled), I still get encounter above issue. I can access Apache welcome page if I type the server IP in browser. Only the port is not resolving correctly.

Is it possible to check whether the http://server-ip:8787/ is resolving to correct file on the server? May be only localhost is resolving and not the IP with ports other than 80?

Thanks.

The problem might not be the server at all but the VPN on the client (the machine running the web browser), which might not be configured to route traffic on arbitrary ports. I'd start by looking at that VPN's configuration.

Why are you running Apache on the RStudio Server? Here are a couple more ideas to try:

  1. If you can, bind RStudio Server to port 80 instead of 8787, to see if you can get traffic through on that port.

  2. If this works, but you want to keep Apache on port 80, you can configure RStudio so that you access it via a custom URL, e.g. server-ip/rstudio/ rather than a custom port. Instructions here: https://support.rstudio.com/hc/en-us/articles/200552326-Running-RStudio-Server-with-a-Proxy

Hi @jonathan,

VPN was not an issue as I am logged without it and using the same network where the server is.

Finally, I solved it and I am not sure which of the following steps helped:

  1. Uninstalled apache from system. I has installed it today just to check if web server is accessible or not.
  2. Edited /etc/rstudio/rserver.conf as:
    www-port=8787
    www-address=<server-ip>
    
  3. Executed sudo rstudio-server restart
  4. RStudio Server accessible via browser :blush:

To test further, removed server IP from /etc/rstudio/rserver.conf and rebooted the system. RStudio Server is still accessible with following system settings:

  1. ufw status is inactive.

  2. sudo netstat -nat | grep LISTEN output:

    tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN
    tcp        0      0 0.0.0.0:8787            0.0.0.0:*               LISTEN
    tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
    tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN
    tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN
    tcp6       0      0 :::111                  :::*                    LISTEN
    tcp6       0      0 :::22                   :::*                    LISTEN
    tcp6       0      0 ::1:631                 :::*                    LISTEN
    tcp6       0      0 ::1:25                  :::*                    LISTEN
    
  3. sudo firewall-cmd --zone=public --list-all output:

    public (active)
      target: default
      icmp-block-inversion: no
      interfaces: enp4s0f1
      sources:
      services: dhcpv6-client ssh
      ports: 8787/tcp 8787/udp
      protocols:
      masquerade: no
      forward-ports:
      source-ports:
      icmp-blocks:
      rich rules:
    

I don't know whether apache was the reason, but I had configured apache today itself. Also, I am not on VPN, but I think it should work out when I am on it. Will give it a try and update here.


Update 1

Hi @edgararuiz, @nick, @jonathan:

Above setup worked with VPN too. I am still clueless what made it work, but it's working. :grinning:

Thanks.

1 Like

I'm so glad is working for you now! Please let us know if you ever figure out what it was, so you're experience can help others that may find themselves in the same situation as you.