centos7 安装R语言遇到的各种坑

本文详细记录了在CentOS7上安装R语言过程中遇到的问题及解决方法,包括依赖gcc、glibc-headers、gcc-c++、gcc-gfortran的安装,以及解决R语言依赖openjdk的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

第一步,可以前往官网网址https://www.r-project.org/下载最新的软件包,我的是R-3.2.3.tar.gz,属于radhat版本。

第二步,解压缩,我也是按照网上的指导将压缩包放到/root目录下,然后解压缩,并进入R-3.2.3目录。

第三步,开始安装R语言:

[root@localhost R-3.2.3]# ./configure

(1)问题1:R语言依赖gcc、glibc-headers、gcc-c++、gcc-gfortran,因此需要部署

[root@localhost R-3.2.3]#yum -y install gcc

[root@localhost R-3.2.3]#yum install glibc-headers

[root@localhost R-3.2.3]# yum install gcc-c++

[root@localhost R-3.2.3]#yum install gcc-gfortran

(2)问题2:R语言安装依赖openjdk

[root@localhost R-3.2.3]#yum install java-1.8.0-openjdk-*

注解:在安装过程中,如果上述软件包没有安装的话,会不断有warning或者error提示,并且会提示相应的关键字。

解决以上两个问题之后就可以顺利的执行安装了,详细过程如下:

[root@localhost R-3.2.3]# ./configure

checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
loading site script './config.site'
loading build-specific script './config.site'
checking for pwd... /usr/bin/pwd
checking whether builddir is srcdir... yes
checking for working aclocal... missing
checking for working autoconf... missing
checking for working automake... missing
checking for working autoheader... missing
checking for gawk... gawk
checking whether ln -s works... yes
checking for bison... no
checking for byacc... no
checking for ar... ar
checking for a BSD-compatible install... /usr/bin/install -c
checking for sed... /usr/bin/sed
checking for which... /usr/bin/which
checking for less... /usr/bin/less
checking for gtar... /usr/bin/gtar
checking for tex... no
checking for pdftex... no
configure: WARNING: you cannot build PDF versions of the R manuals
checking for pdflatex... no
configure: WARNING: you cannot build PDF versions of vignettes and help pages
checking for makeindex... no
checking for texi2any... no
configure: WARNING: you cannot build info or HTML versions of the R manuals
checking for texi2dvi... no
checking for kpsewhich... no
checking for latex inconsolata package... checking for unzip... /usr/bin/unzip
checking for zip... /usr/bin/zip
checking for gzip... /usr/bin/gzip
checking for bzip2... /usr/bin/bzip2
checking for firefox... /usr/bin/firefox
using default browser ... /usr/bin/firefox
checking for acroread... no
checking for acroread4... no
checking for xdg-open... /usr/bin/xdg-open
checking for notangle... false
checking for realpath... /usr/bin/realpath
checking for pkg-config... /usr/bin/pkg-config
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking whether gcc needs -traditional... no
checking how to run the C preprocessor... gcc -E
checking for gfortran... gfortran
checking whether we are using the GNU Fortran 77 compiler... yes
checking whether gfortran accepts -g... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking whether __attribute__((visibility())) is supported... yes
checking whether gcc accepts -fvisibility... yes
checking whether gfortran accepts -fvisibility... yes
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for gcc... gcc
checking whether we are using the GNU Objective C compiler... no
checking whether gcc accepts -g... no
checking for Objective C++ compiler... trying some possibilities
checking whether g++ can compile ObjC++... no
checking whether  can compile ObjC++... no
no working ObjC++ compiler found
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for dlfcn.h... yes
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking how to run the C++ preprocessor... g++ -E
checking whether we are using the GNU Fortran 77 compiler... (cached) yes
checking whether gfortran accepts -g... (cached) yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for gfortran option to produce PIC... -fPIC
checking if gfortran PIC flag -fPIC works... yes
checking if gfortran static flag -static works... no
checking if gfortran supports -c -o file.o... yes
checking if gfortran supports -c -o file.o... (cached) yes
checking whether the gfortran linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for cos in -lm... yes
checking for sin in -lm... yes
checking for dlopen in -ldl... yes
checking readline/history.h usability... yes
checking readline/history.h presence... yes
checking for readline/history.h... yes
checking readline/readline.h usability... yes
checking readline/readline.h presence... yes
checking for readline/readline.h... yes
checking for rl_callback_read_char in -lreadline... yes
checking for history_truncate_file... yes
checking whether rl_completion_matches exists and is declared... yes
checking for ANSI C header files... (cached) yes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking for sys/wait.h that is POSIX.1 compatible... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking dl.h usability... no
checking dl.h presence... no
checking for dl.h... no
checking for dlfcn.h... (cached) yes
checking elf.h usability... yes
checking elf.h presence... yes
checking for elf.h... yes
checking features.h usability... yes
checking features.h presence... yes
checking for features.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking floatingpoint.h usability... no
checking floatingpoint.h presence... no
checking for floatingpoint.h... no
checking fpu_control.h usability... yes
checking fpu_control.h presence... yes
checking for fpu_control.h... yes
checking glob.h usability... yes
checking glob.h presence... yes
checking for glob.h... yes
checking grp.h usability... yes
checking grp.h presence... yes
checking for grp.h... yes
checking langinfo.h usability... yes
checking langinfo.h presence... yes
checking for langinfo.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking pwd.h usability... yes
checking pwd.h presence... yes
checking for pwd.h... yes
checking sched.h usability... yes
checking sched.h presence... yes
checking for sched.h... yes
checking for strings.h... (cached) yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking for sys/stat.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/times.h usability... yes
checking sys/times.h presence... yes
checking for sys/times.h... yes
checking sys/utsname.h usability... yes
checking sys/utsname.h presence... yes
checking for sys/utsname.h... yes
checking for unistd.h... (cached) yes
checking utime.h usability... yes
checking utime.h presence... yes
checking for utime.h... yes
checking stdalign.h usability... yes
checking stdalign.h presence... yes
checking for stdalign.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking for inttypes.h... (cached) yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking stdarg.h usability... yes
checking stdarg.h presence... yes
checking for stdarg.h... yes
checking stdbool.h usability... yes
checking stdbool.h presence... yes
checking for stdbool.h... yes
checking for stdint.h... (cached) yes
checking for string.h... (cached) yes
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking for GNU C library with version >= 2... yes
checking return type of signal handlers... void
checking for uint64_t... yes
checking for int64_t... yes
checking for int_fast64_t... yes
checking for pid_t... yes
checking for size_t... yes
checking whether SIZE_MAX is declared... yes
checking for blkcnt_t... yes
checking for type of socket length... socklen_t *
checking for stack_t... yes
checking for intptr_t... yes
checking for uintptr_t... yes
checking whether byte ordering is bigendian... no
checking for an ANSI C-conforming const... yes
checking for gcc option to accept ISO C99... -std=gnu99
checking for gcc -std=gnu99 option to accept ISO Standard C... (cached) -std=gnu99
checking for inline... inline
checking size of int... 4
checking size of long... 8
checking size of long long... 8
checking size of double... 8
checking size of size_t... 8
checking size of long double... 16
### 在 CentOS 7安装 RStudio #### 安装必要的依赖项 为了确保系统的软件库是最新的,并且可以顺利安装所需的包,先更新yum仓库并安装`epel-release`: ```bash sudo yum update -y sudo yum install epel-release -y ``` #### 安装 R 语言环境 RStudio 需要 R 语言的支持,在此之前需确认已安装 R: ```bash sudo yum install -y R ``` 这一步骤会从 EPEL 源获取最新版本的 R 并完成安装[^3]。 #### 下载并安装 RStudio Server 前往官方下载页面找到适用于 CentOS 7 的 RPM 文件链接。这里提供了一个具体的命令来下载特定版本的 RStudio Server: ```bash wget https://download2.rstudio.org/server/centos7/x86_64/rstudio-server-rhel-2023.12.0-369-x86_64.rpm sudo yum install -y rstudio-server-rhel-2023.12.0-369-x86_64.rpm ``` 上述命令用于下载并安装指定版本的 RStudio Server 到 CentOS 7 系统中[^1]。 #### 启动与管理 RStudio Server 服务 一旦安装成功,可以通过下面的命令启动 RStudio Server 服务: ```bash sudo systemctl start rstudio-server ``` 如果遇到任何问题,可利用 `verify-installation` 命令排查可能存在的错误: ```bash sudo rstudio-server verify-installation ``` 对于日常管理和维护来说,还可以使用如下命令停止或重启该服务: ```bash sudo systemctl stop rstudio-server sudo systemctl restart rstudio-server ``` #### 访问 RStudio Server 最后,打开浏览器并通过 URL 地址访问新部署的服务,默认端口为 8787 : http://Server_IP:8787/ 请注意,这里的 "Server_IP" 应替换为实际服务器 IP 地址。首次登录时建议创建一个新的非 root 用户账户来进行安全连接测试[^4]。
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值