下载源码包并解压
# wget https://mirrors.tuna.tsinghua.edu.cn/CRAN/src/base/R-4/R-4.1.1.tar.gz
# tar zxvf R-4.1.1.tar.gz
# cd R-4.1.1/
配置安装文件
# ./configure --enable-R-shlib --prefix=/path/R/4.1.1
报错:
configure: error: PCRE2 library and headers are required, or use --with-pcre1 and PCRE >= 8.32 with UTF-8 support
下载pcre并安装
# wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
# tar zxvf pcre-8.44.tar.gz
# cd pcre-8.44/
# ./configure --enable-utf8
# make && make install
# echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib">>/etc/profile
# source /etc/profile
安装R4.1.1
# ./configure --enable-R-shlib --prefix=/path/R/4.1.1 --with-pcre1
# make&&make install
根据用户需求自定义端口、R版本,开启后台服务
su - root -c "module load anaconda3/2020.02;source activate R-4.1.1;nohup /usr/lib/rstudio-server/bin/rserver --server-daemonize=0 --www-port 6089 --rsession-which-r=$(which R) --rsession-ld-library-path=$CONDA_PREFIX/lib &>>/root/rstudio-conda.log &"