如何在 Ubuntu 16.04 Xenial 上安装 R?

如何在 Ubuntu 16.04 Xenial 上安装 R?

是否有一个方便的 shell 脚本可以让你一次性安装所有内容?

答案1

  1. 我们需要添加R 存储库,然后从中安装软件包:

    • 3.4.4

      cat <<EOF | sudo tee /etc/apt/sources.list.d/r-cran.list
      deb https://cloud.r-project.org/bin/linux/ubuntu xenial/
      EOF
      sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
      
      sudo apt-get update
      sudo apt-get install r-base r-base-dev
      
    • 4.0

      cat <<EOF | sudo tee /etc/apt/sources.list.d/r-cran.list
      deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran40/
      EOF
      sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
      
      sudo apt-get update
      sudo apt-get install r-base r-base-dev
      
  2. 从以下网址下载 RStudio官方网站, 例如,版本 1.2.5042,然后使用以下命令进行安装gdebi

    wget https://download1.rstudio.org/desktop/xenial/amd64/rstudio-1.2.5042-amd64.deb
    sudo apt-get install ./rstudio-1.2.5042-amd64.deb
    

答案2

方便的话,有吧这里!此shell脚本的内容:

# Install R + RStudio on Ubuntu 16.04

sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys E084DAB9

# Ubuntu 12.04: precise
# Ubuntu 14.04: trusty
# Ubuntu 16.04: xenial
# Basic format of next line deb https://<my.favorite.cran.mirror>/bin/linux/ubuntu <enter your ubuntu version>/
sudo add-apt-repository 'deb https://ftp.ussg.iu.edu/CRAN/bin/linux/ubuntu xenial/'
sudo apt-get update
sudo apt-get install r-base
sudo apt-get install r-base-dev

# Download and Install RStudio
sudo apt-get install gdebi-core
wget https://download1.rstudio.org/rstudio-1.0.44-amd64.deb
sudo gdebi rstudio-1.0.44-amd64.deb
rm rstudio-1.0.44-amd64.deb

相关内容