下載源碼包並解壓
# 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
編譯再次報錯:
configure: error: libcurl >= 7.28.0 library and headers are required with support for https
查看系統已經安裝7.28版本的curl
原因可能是因為安裝curl時沒有關聯ssl
下載符合要求的curl版本
./configure --with-ssl --prefix=/usr/local/curl-7.80
make && make install
export PATH=/usr/local/curl-7.80/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/curl-7.80/lib:$LD_LIBRARY_PATH
安裝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 &"
