1、軟件源文件,添加CRAN源(默認安裝成功是R3.4版本,使用這個方法更新也是可以的)
sudo vim /etc/apt/sources.list
添加一行cran源,網上有人推薦清華的源,但是我試了,不好用,還是阿里雲這個好用
deb http://mirrors.aliyun.com/CRAN/bin/linux/ubuntu/ bionic-cran40/
2更新軟件園
sudo apt-get update
如果出現未簽名錯誤,The following signatures couldn't be verified because the public key is not acailable:NO_PUBKEY xxxxxxxxxx
使用如下代碼簽名
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys xxxxxxxxxx //你電腦上出現
3安裝R
sudo apt-get install r-base
4在安裝Rstudio-server
sudo apt-get install gdebi-core wget https://download2.rstudio.org/rstudio-server-1.1.383-amd64.deb sudo gdebi rstudio-server-1.1.383-amd64.deb
如果是自己服務器上的ubuntu系統的話,其實通過上述步驟就算安裝好了,查看下Rstudio-server是否在運行(理論上安裝完后就啟動的)
ps -aux|grep rstudio-server #rstudio+ 1777 0.1 0.0 195676 8476 ? Ssl 20:47 0:00 /usr/lib/rstudio-server/bin/rserver
最后通過筆記本瀏覽器登錄服務器上的Rstudio-server,輸入你對應的IP地址和端口,然后輸入服務器的主機的用戶名和密碼即可登錄;
如果R 安裝包的時候提示 Configuration failed because libcurl wha not found.Try installing:.......
使用如下命令安裝curl包即可
sudo apt-get install libcurl4-openssl-dev