CentOS 7安裝R和Rstudio

首先安裝服務器依賴

sudo yum install epel-release
sudo yum update

安裝R

Posit公司正統教程
RStudio Server - Posit

找到需要的R版本

Posit - Install R - Posit Documentation

Versions of R that are available include:

4.2.2, 4.2.1, 4.2.0, 4.1.3, 4.1.2, 4.1.1, 4.1.0, 4.0.5, 4.0.4, 4.0.3, 4.0.2, 4.0.1, 4.0.0

3.6.3, 3.6.2, 3.6.1, 3.6.0, 3.5.3, 3.5.2, 3.5.1, 3.5.0, 3.4.4, 3.4.3, 3.4.2, 3.4.1, 3.4.0, 3.3.3, 3.3.2, 3.3.1, 3.3.0

If you need to use an earlier version of R, then you will need to modify the export command shown above:

下載和安裝R

替換掉上面的R版本就行

curl -O https://cdn.rstudio.com/r/centos-7/pkgs/R-${R_VERSION}-1-1.x86_64.rpm
sudo yum install R-${R_VERSION}-1-1.x86_64.rpm

創建到 R 的鏈接

sudo ln -s /opt/R/${R_VERSION}/bin/R /usr/local/bin/R
sudo ln -s /opt/R/${R_VERSION}/bin/Rscript /usr/local/bin/Rscript
sudo ln -s /opt/R/${R_VERSION}/bin/R /usr/local/bin/R

設置R的權限

劃重點:)

也就是給/opt/R/這個目錄全體用戶起碼是可讀權限

試著在普通用戶狀態進入這個目錄,如果出現 Permission denied,那么就說明權限設置不對,這個目錄沒法給非root賬戶讀取

cd /opt/R/${R_VERSION}/bin/
chmod -R a+rw  /opt/R/

#### 或者簡單粗暴
chmod  777  /opt/R/

安裝Rstudio

wget https://download2.rstudio.org/server/centos7/x86_64/rstudio-server-rhel-2022.07.2-576-x86_64.rpm
sudo yum install rstudio-server-rhel-2022.07.2-576-x86_64.rpm

然后在瀏覽器中輸入網址ID加上端口8787就行

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容