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博客

相关内容

热门资讯

常用商务英语口语   商务英语是以适应职场生活的语言要求为目的,内容涉及到商务活动的方方面面。下面是小编收集的常用商务...
六年级上册英语第一单元练习题   一、根据要求写单词。  1.dry(反义词)__________________  2.writ...
复活节英文怎么说 复活节英文怎么说?复活节的英语翻译是什么?复活节:Easter;"Easter,anniversar...
2008年北京奥运会主题曲 2008年北京奥运会(第29届夏季奥林匹克运动会),2008年8月8日到2008年8月24日在中华人...
英语道歉信 英语道歉信15篇  在日常生活中,道歉信的使用频率越来越高,通过道歉信,我们可以更好地解释事情发生的...
六年级英语专题训练(连词成句... 六年级英语专题训练(连词成句30题)  1. have,playhouse,many,I,toy,i...
上班迟到情况说明英语   每个人都或多或少的迟到过那么几次,因为各种原因,可能生病,可能因为交通堵车,可能是因为天气冷,有...
小学英语教学论文 小学英语教学论文范文  引导语:英语教育一直都是每个家长所器重的,那么有关小学英语教学论文要怎么写呢...
英语口语学习必看的方法技巧 英语口语学习必看的方法技巧如何才能说流利的英语? 说外语时,我们主要应做到四件事:理解、回答、提问、...
四级英语作文选:Birth ... 四级英语作文范文选:Birth controlSince the Chinese Governmen...
金融专业英语面试自我介绍 金融专业英语面试自我介绍3篇  金融专业的学生面试时,面试官要求用英语做自我介绍该怎么说。下面是小编...
我的李老师走了四年级英语日记... 我的李老师走了四年级英语日记带翻译  我上了五个学期的小学却换了六任老师,李老师是带我们班最长的语文...
小学三年级英语日记带翻译捡玉... 小学三年级英语日记带翻译捡玉米  今天,我和妈妈去外婆家,外婆家有刚剥的`玉米棒上带有玉米籽,好大的...
七年级英语优秀教学设计 七年级英语优秀教学设计  作为一位兢兢业业的人民教师,常常要写一份优秀的教学设计,教学设计是把教学原...
我的英语老师作文 我的英语老师作文(通用21篇)  在日常生活或是工作学习中,大家都有写作文的经历,对作文很是熟悉吧,...
英语老师教学经验总结 英语老师教学经验总结(通用19篇)  总结是指社会团体、企业单位和个人对某一阶段的学习、工作或其完成...
初一英语暑假作业答案 初一英语暑假作业答案  英语练习一(基础训练)第一题1.D2.H3.E4.F5.I6.A7.J8.C...
大学生的英语演讲稿 大学生的英语演讲稿范文(精选10篇)  使用正确的写作思路书写演讲稿会更加事半功倍。在现实社会中,越...
VOA美国之音英语学习网址 VOA美国之音英语学习推荐网址 美国之音网站已经成为语言学习最重要的资源站点,在互联网上还有若干网站...
商务英语期末试卷 Part I Term Translation (20%)Section A: Translate ...