我有一个x86_64
系统正在运行CentOS 7
。我有安装和配置 R
并RStudio Server
对其进行访问,但无法通过http://<server-ip>:8787
as访问它此处的文档建议。我收到以下错误Google Chrome
:
This site can’t be reached
<server-ip> refused to connect.
Search Google for 206 196 8787
ERR_CONNECTION_REFUSED
我尝试并验证了许多网络、防火墙设置。但似乎都不起作用。
R 正在系统上工作
~$ 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 已配置并处于活动状态
~$ 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 输出显示端口可以监听
~$ 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
防火墙显示端口已打开
~$ 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 输出
~$ 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:
谁能帮我指出我错在哪里?
谢谢。
答案1
我不确定什么方法有效,什么方法无效,但以下步骤有所帮助。有关此内容的更多详细信息,请参阅可在 RStudio 社区支持上获取。
脚步:
apache
已从系统中卸载。已编辑/etc/rstudio/rserver.conf作为
www-port=8787 www-address=<server-ip>
已执行sudo rstudio-server 重新启动
- 可通过浏览器访问 RStudio Server。
此外,即使没有RStudio Server
也可以访问。www-address=<server-ip>
/etc/rstudio/rserver.conf
笔记:Apache
今天本身就进行了配置,只是测试是否至少可以通过浏览器访问 Web 服务器。