1、查看系统
[root@centos8 home]# cat /etc/redhat-release CentOS Linux release 8.3.2011 [root@centos8 home]# hostnamectl Static hostname: centos8 Icon name: computer-vm Chassis: vm Machine ID: d5fd22581df140c192815b766d6ec0d7 Boot ID: c7ff573d91e34d83a0c2b0caec78aafc Virtualization: vmware Operating System: CentOS Linux 8 CPE OS Name: cpe:/o:centos:centos:8 Kernel: Linux 4.18.0-240.el8.x86_64 Architecture: x86-64
2、查看R版本及可执行性程序
[root@centos8 home]# R --version R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out" Copyright (C) 2020 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under the terms of the GNU General Public License versions 2 or 3. For more information about these matters see https://www.gnu.org/licenses/.
[root@centos8 home]# which R /home/software/R/bin/R
3、下载Rstudio安装包
下载地址:https://rstudio.com/products/rstudio/download-server/redhat-centos/
[root@centos8 home]# wget /home/ https://download2.rstudio.org/server/centos8/x86_64/rstudio-server-rhel-1.4.1103-x86_64.rpm
[root@centos8 home]# ls liujiaxin01 pcre2-10.36 pcre2-10.36.zip R-4.0.3 rstudio-server-rhel-1.4.1103-x86_64.rpm software test
4、安装
[root@centos8 home]# yum install --nogpgcheck rstudio-server-rhel-1.4.1103-x86_64.rpm ………… ………… Installed: libpq-12.4-1.el8_2.x86_64 rstudio-server-1.4.1103-1.x86_64 Complete!
5、启用rsudio服务并查看rstudio服务状态
[root@centos8 home]# systemctl start rstudio-server [root@centos8 home]# systemctl status rstudio-server.service ● rstudio-server.service - RStudio Server Loaded: loaded (/usr/lib/systemd/system/rstudio-server.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Tue 2021-02-02 23:31:19 CST; 8s ago Process: 115000 ExecStart=/usr/lib/rstudio-server/bin/rserver (code=exited, status=0/SUCCESS) Main PID: 115001 (code=exited, status=1/FAILURE) Feb 02 23:31:19 centos8 systemd[1]: rstudio-server.service: Main process exited, code=exited, status=1/FAILURE Feb 02 23:31:19 centos8 systemd[1]: rstudio-server.service: Failed with result 'exit-code'. Feb 02 23:31:19 centos8 systemd[1]: rstudio-server.service: Service RestartSec=100ms expired, scheduling restart. Feb 02 23:31:19 centos8 systemd[1]: rstudio-server.service: Scheduled restart job, restart counter is at 5. Feb 02 23:31:19 centos8 systemd[1]: Stopped RStudio Server. Feb 02 23:31:19 centos8 systemd[1]: rstudio-server.service: Start request repeated too quickly. Feb 02 23:31:19 centos8 systemd[1]: rstudio-server.service: Failed with result 'exit-code'. Feb 02 23:31:19 centos8 systemd[1]: Failed to start RStudio Server.
6、修改rstudio服务配置文件
[root@centos8 home]# which R /home/software/R/bin/R [root@centos8 home]# echo "rsession-which-r=/home/software/R/bin/R" >> /etc/rstudio/rserver.conf
7、重启rstudio服务,并查看服务状态
[root@centos8 home]# systemctl restart rstudio-server.service [root@centos8 home]# systemctl status rstudio-server.service ● rstudio-server.service - RStudio Server Loaded: loaded (/usr/lib/systemd/system/rstudio-server.service; enabled; vendor preset: disabled) Active: active (running) since Tue 2021-02-02 23:34:45 CST; 7s ago Process: 115062 ExecStart=/usr/lib/rstudio-server/bin/rserver (code=exited, status=0/SUCCESS) Main PID: 115063 (rserver) Tasks: 3 (limit: 11075) Memory: 42.8M CGroup: /system.slice/rstudio-server.service └─115063 /usr/lib/rstudio-server/bin/rserver Feb 02 23:34:45 centos8 systemd[1]: Starting RStudio Server... Feb 02 23:34:45 centos8 systemd[1]: Started RStudio Server.
8、浏览器登录测试,登录格式为http//IP:8787 (IP为linux系统IP,8787为默认的服务端口)
当前无法登录。
9、开启8787端口
[root@centos8 home]# firewall-cmd --permanent --zone=public --add-port=8787/tcp ## 开启8787端口 success [root@centos8 home]# firewall-cmd --reload ## 立即生效 success
10、在浏览器端测试登录
立即弹出登录界面
11、检查rstudio服务状态,(起初尝试了root登录,实际root不能登录,报错信息红色部分主要是权限信息)
12、关闭SElinux
[root@centos8 home]# getenforce ## 查看sellinux服务 Enforcing [root@centos8 home]# setenforce 0 ## 关闭 [root@centos8 home]# getenforce Permissive
13、刷新登录界面,可以登录
安装完成。
参考:
https://www.linuxidc.com/Linux/2012-03/55941.htm
https://rstudio.com/products/rstudio/download-server/redhat-centos/
https://www.cndba.cn/simon/article/2621
https://zhuanlan.zhihu.com/p/188711437