1

I have a x86_64 system running CentOS 7. I have installed and configured R and RStudio Server on it, but not able to access it via http://<server-ip>:8787 as suggested by the documentation here. I get following error on Google Chrome:

This site can’t be reached
<server-ip> refused to connect.
Search Google for 206 196 8787
ERR_CONNECTION_REFUSED

I tried and verified many network, firewall settings. However, nothing seems to be working.

R working on system

~$ 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"

RStudio Server is configured and active

~$ sudo rstudio-server verify-installation
~$ sudo 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 21:33:53 MST; 1s ago
  Process: 8300 ExecStop=/usr/bin/killall -TERM rserver (code=exited, status=0/SUCCESS)
  Process: 8346 ExecStart=/usr/lib/rstudio-server/bin/rserver (code=exited, status=0/SUCCESS)
 Main PID: 8349 (rserver)
   CGroup: /system.slice/rstudio-server.service
           └─8349 /usr/lib/rstudio-server/bin/rserver

Oct 21 21:33:53 localhost.localdomain systemd[1]: Starting RStudio Server...
Oct 21 21:33:53 localhost.localdomain systemd[1]: Started RStudio Server.
~$ sudo rstudio-server restart
rsession: no process found
~$ sudo rstudio-server start
~$ sudo rstudio-server stop
rsession: no process found
~$ sudo rstudio-server start
~$ sudo 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 21:34:14 MST; 2s ago
  Process: 8449 ExecStop=/usr/bin/killall -TERM rserver (code=exited, status=0/SUCCESS)
  Process: 8477 ExecStart=/usr/lib/rstudio-server/bin/rserver (code=exited, status=0/SUCCESS)
 Main PID: 8480 (rserver)
   CGroup: /system.slice/rstudio-server.service
           └─8480 /usr/lib/rstudio-server/bin/rserver

Oct 21 21:34:14 localhost.localdomain systemd[1]: Starting RStudio Server...
Oct 21 21:34:14 localhost.localdomain systemd[1]: Started RStudio Server.

netstat output shows port can listen

~$ 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

Firewall says port is open

~$ sudo ufw allow 8787
~$ sudo ufw status
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)

systemctl output

~$ 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:

Can anyone please help me point where I am going wrong?

Thanks.

  • In addition to the host based firewall there may be others in between your client and server that block traffic https://serverfault.com/q/725262/37681 and I wasn’t aware that you could mix ufw and firewalld to manage the firewall on one system – HBruijn Oct 22 '17 at 07:26
  • @HBruijn - I tried the solution in the link you shared, everything checked out as per that post too. I am not sure where I am going wrong. Anything else you may suggest that I can try? Did ask on `RStudio` forum, still no possible workaround. – Chetan Arvind Patil Oct 22 '17 at 22:07
  • Did you also capture use tcpdump to see which system is generating the connection refused message? – HBruijn Oct 23 '17 at 03:21
  • @HBruijn - I did and I don't get anything except this when I run that. I waited for hours and still nothing else. `tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on virbr0, link-type EN10MB (Ethernet), capture size 262144 bytes`. Also, tried accessing application from browser while this command was running and still no log generated. – Chetan Arvind Patil Oct 23 '17 at 22:08

1 Answers1

0

I am not sure what worked and what not, but following steps helped. More details on this are available on RStudio community support.

Steps:

  1. Uninstalled apache from system.
  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.

Also, RStudio Server can be accessed even without www-address=<server-ip> in /etc/rstudio/rserver.conf.

Note: Apache was configured today itself to just test if at least web server is accessible via browser or not.