Ubuntu 使用命令apt-get install r-base
安装的R,默认版本为3.4.4, 无法直接进行版本升级到4.0以上版本。
可通过如下方法安装最新的R版本
- 更新索引
apt update -qq
- 安装两个帮助包
apt install --no-install-recommends software-properties-common dirmngr
- 导入签名秘钥(by Michael Rutter)
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
- 将R 4.0仓库添加到源目录,将在 在/etc/apt/sources.list 里添加一行, 注意这里
$(lsb_release -cs)
会根据系统的版本来选择’focal’ 、 ‘groovy’ 、 ‘bionic’ 等等
add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
- 安装R
apt install --no-install-recommends r-base
注:以上步骤来自: https://cran.r-project.org/bin/linux/ubuntu/