centos6下为Rstudio安装多版本R
创始人
2024-05-30 04:41:42
0

之前的R版本太旧,不少包装不上,需要安装新版本的R:

R --version
R version 3.6.0 (2019-04-26) -- "Planting of a Tree"

于是下载最新版R:

因为没有证书,需要加上最后面的参数.

wget https://mirrors.tuna.tsinghua.edu.cn/CRAN/src/base/R-4/R-4.2.2.tar.gz --no-check-certificate

或者使用 

yum install -y ca-certificates

第一次配制报错:

./configure --enable-R-shlib --prefix=/opt/R/R-4.2.2 --with-x=no
...
checking for readline/history.h... no
checking for readline/readline.h... no
checking for rl_callback_read_char in -lreadline... no
checking for main in -lncurses... no
checking for main in -ltinfo... no
checking for main in -ltermcap... no
checking for main in -ltermlib... no
checking for rl_callback_read_char in -lreadline... no
configure: error: --with-readline=yes (default) and headers/libs are not available

这是因为没有装readline这个包:

sudo yum install readline-devel
...
Running transactionInstalling : ncurses-devel-5.9-14.20130511.el7_4.x86_64                   1/2 Installing : readline-devel-6.2-11.el7.x86_64                             2/2 Verifying  : readline-devel-6.2-11.el7.x86_64                             1/2 Verifying  : ncurses-devel-5.9-14.20130511.el7_4.x86_64                   2/2 Installed:readline-devel.x86_64 0:6.2-11.el7                                            Dependency Installed:ncurses-devel.x86_64 0:5.9-14.20130511.el7_4                                  Complete!

然后继续配置:

./configure --enable-R-shlib --prefix=/opt/R/R-4.2.2 --with-x=no  --with-readline=yes --with-libpng=yes --with-blas
...
R is now configured for x86_64-pc-linux-gnuSource directory:            .Installation directory:      /opt/R/R-4.2.2C compiler:                  gcc -std=gnu11  -g -O2Fortran fixed-form compiler: gfortran  -g -O2Default C++ compiler:        g++ -std=gnu++11  -g -O2C++11 compiler:              g++ -std=gnu++11  -g -O2C++14 compiler:                 C++17 compiler:                 C++20 compiler:                 Fortran free-form compiler:  gfortran  -g -O2Obj-C compiler:	        Interfaces supported:        tcltkExternal libraries:          pcre2, readline, curlAdditional capabilities:     PNG, JPEG, TIFF, NLS, ICUOptions enabled:             shared R library, shared BLAS, R profilingCapabilities skipped:        cairoOptions not enabled:         memory profilingRecommended packages:        yesconfigure: WARNING: neither inconsolata.sty nor zi4.sty found: PDF vignettes and package manuals will not be rendered optimally

最后一段警告信息让人不爽. 这是latex的sty包没装,于是装一下:

wget http://mirrors.ctan.org/fonts/inconsolata.zipunzip inconsolata.zip
Archive:  inconsolata.zipcreating: inconsolata/...inflating: inconsolata/tex/inconsolata.sty ...cp -R inconsolata/* /usr/share/texmf/sudo yum install texlivesudo texhash
texhash: Updating /usr/share/texlive/texmf/ls-R... 
texhash: Updating /usr/share/texlive/texmf-config/ls-R... 
texhash: Updating /usr/share/texlive/texmf-dist/ls-R... 
texhash: Updating /usr/share/texlive/texmf-local///ls-R... 
texhash: Updating /usr/share/texlive/texmf-var/ls-R... 
texhash: Done.

然后再配置就不会有警告信息了:

./configure --enable-R-shlib --prefix=/opt/R/R-4.2.2 --with-x=no  --with-readline=yes --with-libpng=yes --with-blas
...
R is now configured for x86_64-pc-linux-gnuSource directory:            .Installation directory:      /opt/R/R-4.2.2C compiler:                  gcc -std=gnu11  -g -O2Fortran fixed-form compiler: gfortran  -g -O2Default C++ compiler:        g++ -std=gnu++11  -g -O2C++11 compiler:              g++ -std=gnu++11  -g -O2C++14 compiler:                 C++17 compiler:                 C++20 compiler:                 Fortran free-form compiler:  gfortran  -g -O2Obj-C compiler:	        Interfaces supported:        tcltkExternal libraries:          pcre2, readline, curlAdditional capabilities:     PNG, JPEG, TIFF, NLS, ICUOptions enabled:             shared R library, shared BLAS, R profilingCapabilities skipped:        cairoOptions not enabled:         memory profilingRecommended packages:        yes

configuare 参数说明:

–enable-R-shlib 表示生成libR.so库,当需要进行gcc等编译的时候很重要,确保之后安装R-studio-server时会出现 找不到"lib.so"文件的错误。

–with-readline=yes表示用于R shell条件下的调试优化

–with-libpng=yes表示可导出png图片

–with-blas表示优化R运算并生成libRblas.so库

–prefix 设定安装路径,否则make install会去安装到/usr/lib文件夹下,非root用户没有权限.

然后再

make
make install

最后将R指向新装的R

which R
sudo mv /usr/bin/R /usr/bin/R.3.6
ln -s /opt/R/R-4.2.2/bin/R /usr/bin/R
RR version 4.2.2 (2022-10-31) -- "Innocent and Trusting"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

Innocent and Trusting...ok....重启Rstudio...

但悲剧还没结束, Rstudio版本太旧, 不匹配R4.2.2里的图形引擎:

 

 

ref:

Ubntu 14.04 LTS 下编译安装R Source Code_Linux教程_Linux公社-Linux系统门户网站

全网最全:新处理器安装R所出现的报错问题 - 简书

linux服务器上装r,linux服务器安装R语言及Rstudio server_weixin_39595085的博客-CSDN博客

相关内容

热门资讯

重阳节优秀致辞 重阳节优秀致辞范文  无论是身处学校还是步入社会,大家都用到过致辞吧,在各种重大的庆典、外交、纪念活...
QQ群晚会开幕词 QQ群晚会开幕词  QQ群晚会开幕词    尊贵的各位嘉宾,群主,各位管理,群友们大家晚上好:   ...
主持谢幕词 主持谢幕词范本  篇一:主持谢幕词  愿一切荣耀、尊贵、颂赞都归给至高上帝!  都说“台上一分钟,台...
圣诞节联欢晚会主持词 圣诞节联欢晚会主持词  主持词的写作需要将主题贯穿于所有节目之中。在一步步向前发展的社会中,主持词与...
元宵节的主持词 元宵节的主持词  一般在节日的时候,都是会举行一些活动的,尤其是在元宵节这个大型的节日。下面是小编为...
初中生晨会主持词 初中生晨会主持词(通用5篇)  主持词要尽量增加文化内涵、寓教于乐,不断提高观众的文化知识和素养。现...
晨会主持词开场白   开晨会是公司职场管理的规章制度,那么公司晨会主持如何开场白好呢?以下是小编为大家搜集整理提供到的...
企业年会主持词 企业年会主持词  主持词是主持人在台上表演的灵魂之所在。在人们越来越多的参与各种活动的今天,主持词是...
企业晚会的主持词 企业晚会的主持词  借鉴诗词和散文诗是主持词的一种写作手法。在人们越来越多的参与各种活动的今天,主持...
年终总结会主持词 2021年终总结会主持词范文(精选13篇)  契合现场环境的主持词能给集会带来双倍的效果。现今社会在...
半台词爆笑 三句半台词大全爆笑  三句半是一种中国民间群众传统曲艺表演形式,下面是为带大家整理的爆笑的'三句半台...
三八妇女节活动主持词 三八妇女节活动主持词3篇  三月的春风拂过我们脚下的土地,三月的惊雷敲响了我们奋进的汽笛,三月我们迎...
文艺晚会主持人主持词 文艺晚会主持人主持词(精选10篇)  主持词是各种演出活动和集会中主持人串联节目的串联词。在当下这个...
校园文艺晚会结束语 下面文艺晚会结束语是小编为你们寻找的,希望你们会喜欢喔文艺晚会结束语一女1:最明快的,莫过于一年一度...
红色经典诵读主持词 红色经典诵读主持词红色经典诵读主持词尊敬的各位领导、敬爱的老师、亲爱的同学们 :大家好!甲:今天的阳...
答谢会主持词 答谢会主持词15篇  主持词要根据活动对象的不同去设置不同的主持词。随着中国在不断地进步,主持人在活...
年会游戏主持词 年会游戏主持词  主持词没有固定的格式,他的最大特点就是富有个性。在人们积极参与各种活动的今天,主持...
《我是女王》经典台词及剧情介... 《我是女王》经典台词及剧情介绍  一、经典台词  一个偶尔会消失的男人,总有一天会永远的消失。  女...
追梦的主持串词 关于追梦的主持串词  篇一:梦想串词  各位老师,大家好:  又到了一个追梦的季节。春之漫妙、夏之热...
生日宴会精彩致辞 生日宴会精彩致辞(精选5篇)  在日常学习、工作抑或是生活中,大家都不可避免地会接触到致辞吧,致辞是...