由centos 7 安装 R3.5.0 修改而来,已测试通过(可能有个别问题未测试到)
记录一下R的安装过程,服务器系统版本为centos 8,R版本为最新版4.1.3。下面是安装步骤:
- wget https://cran.r-project.org/src/base/R-4/R-对应版本号.tar.gz
- 解压文件:tar –zvxf R-对应版本号.tar.gz
- 在解压的文件夹中执行:./configure – -enable-R-shlib=yes – -prefix=/share/soft/R-4.1.3
- make
- make install
- 配置R环境变量
\$ vim /etc/profile
export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/share/soft/R-4.1.3/lib64
export PATH=/share/soft/R-4.1.3/bin:$PATH
Error1:–with-readline=yes (default) and headers/libs are not available #使用tab自动补全以及上下左右等方向键
$ yum install readline-devel
Error2:–with-x=yes (default) and X11 headers/libs are not available #使用图形界面
$ yum install libXt-devel
centos 8 安装R-4.0.5时会遇到如下问题,应该安装R-4.0.5以上版本类同:
在安装gcc后,安装报差什么库就安装什么库:
yum install gcc-gfortran #configure: error: No Fortran compiler found yum install xz-devel.x86_64 #configure: error: "liblzma library and headers are required" ;命令由yum search liblzma得来 yum install libcurl-devel #configure: error: libcurl >= 7.28.0 library and headers are required with support for https。
Rstudio server 安装完后报错:
rstudio-server status ● rstudio-server.service - RStudio Server Loaded: loaded (/usr/lib/systemd/system/rstudio-server.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Mon 2021-04-19 10:59:23 EDT; 8min ago Process: 124226 ExecStart=/usr/lib/rstudio-server/bin/rserver (code=exited, status=0/SUCCESS) Main PID: 124227 (code=exited, status=1/FAILURE) 4月 19 10:59:23 localhost.localdomain systemd[1]: rstudio-server.service: Service RestartSec=100ms expired, scheduling restart. 4月 19 10:59:23 localhost.localdomain systemd[1]: rstudio-server.service: Scheduled restart job, restart counter is at 5. 4月 19 10:59:23 localhost.localdomain systemd[1]: Stopped RStudio Server. 4月 19 10:59:23 localhost.localdomain systemd[1]: rstudio-server.service: Start request repeated too quickly. 4月 19 10:59:23 localhost.localdomain systemd[1]: rstudio-server.service: Failed with result 'exit-code'. 4月 19 10:59:23 localhost.localdomain systemd[1]: Failed to start RStudio Server. [root@localhost system]# rstudio-server verify-installation
原因是我是自定义安装的R,虽然已经加了环境变量还是需要在配置文件中指定:
[root@localhost]# vi /etc/rstudio/rserver.conf ###在两个配置文件中添加以下语句 rsession-which-r=/share/soft/R-4.0.5/bin/R ##R程序所在位置,虽加了环境变量不指定位置依然会报错。 www-port=8787 ### 通过ip的8787端口连接 ###重启服务: [root@localhost]# rstudio-server kill-all [root@localhost]# rstudio-server start [root@localhost]# rstudio-server status rstudio-server.service - RStudio Server Loaded: loaded (/usr/lib/systemd/system/rstudio-server.service; enabled; vendor preset: disabled) Active: active (running) since Mon 2021-04-19 11:18:40 EDT; 3s ago Process: 124703 ExecStart=/usr/lib/rstudio-server/bin/rserver (code=exited, status=0/SUCCESS) Main PID: 124704 (rserver) Tasks: 3 (limit: 1645654) Memory: 15.6M CGroup: /system.slice/rstudio-server.service └─124704 /usr/lib/rstudio-server/bin/rserver
https://segmentfault.com/a/1190000007553604?from=singlemessage
https://blog.csdn.net/ustczyy/article/details/14448445
https://www.cnblogs.com/emanlee/p/7835458.html
https://www.jianshu.com/p/44169741bd22
https://bbs.pinggu.org/thread-4664150-1-1.html
https://blog.csdn.net/gavin_cdc/article/details/88981332
尊重他人劳动成果,转载请注明出处:Bluesky's blog » centos 8 自定义安装最新版R-4.1.3