1、安裝下載R
wget https://cran.r-project.org/src/base/R-4/R-4.1.0.tar.gz
2、解壓在/usr/local下
tar -zxvf R-4.1.0.tar.gz
3、正式安裝R之前,需要安裝各種依賴包
yum -y install bzip2-devel
yum -y install xz-devel.x86_64
yum install readline-devel
yum install gcc-gfortran
yum -y install bzip2-devel
yum install glibc-headers
yum -y install gcc
yum install gcc-c++
yum install libXt-devel
yum install -y gcc
yum install -y glibc-headers
yum install -y libreadline6-dev gfortran
yum install -y readline-devel
yum install -y wget libXt-devel
yum install -y fonts-chinese tcl tcl-devel tclx tk tk-devel
yum install -y mesa-libGLU mesa-libGLU-devel
yum install -y install bzip2-devel
yum install -y install xz-devel.x86_64
yum install -y install pcre-devel
yum install -y install libcurl
yum install -y install libcurl-devel
yum install -y texinfo.x86_64
yum install -y texlive-pdftex-doc.noarch
yum install -y texlive
yum install java.1.8.0-openjdk-*
4、創建編譯的文件夾目錄R
mkdir /usr/local/R
5、進入R安裝包並進行環境編譯
cd /usr/local/R4.1.0
./configure --enable-R-shlib=yes --with-tcltk --prefix=/usr/local/R
6、開始安裝
make & make insttall
7、安裝完成后,打開/etc/profile,並在最后一行添加環境參數
vi /etc/profile
----------------
R_HOME=/usr/local/R
PATH=$PATH:$R_HOME/bin
8、安裝配置完成后可以測試R
[root@centos]#R
9、下載Rstudio
wget https://download2.rstudio.org/server/centos6/x86_64/rstudio-server-rhel-1.2.5033-x86_64.rpm
10、安裝Rstudio
yum install -y rstudio-server-rhel-1.2.5033-x86_64.rpm
11、安裝完成后需要開啟8787端口
systemctl enable rstudio-server.service
systemctl start rstudio-server.service
systemctl status rstudio-server
firewalld
firewall-cmd --permanent --add-port=8787/tcp
firewall-cmd --permanent --add-port=8787/udp
firewall-cmd --reload
12、設置完成后,重啟Rstudio
rstudio-server restart
(沒有任何消息表示安裝完成)
如果有提示,可以使用rstudio-server verify-installation查看問題
13、完成后,使用瀏覽器訪問測試
http://ip:8787
-----------------------------------------------------------------------------
安裝過程的問題:
1、報錯:configure: error: PCRE2 library and headers are required, or use --with-pcre1 and PCRE >= 8.32 with UTF-8 support
需要使用下面命令
yum install pcre2*
2、報錯:configure: WARNING: neither inconsolata.sty nor zi4.sty found: PDF vignettes and package manuals will not be rendered optimally
需要使用下面命令
wget http://mirrors.ctan.org/fonts/inconsolata.zip
unzip inconsolata.zip
前提安裝zip/unzip
yum install zip
yum install unzip
遷移解壓好的inconsolata
cp -Rfp inconsolata/* /usr/share/texmf
刷新sty
mktexlsr