Linux如何安装最新版本R语言
Linux如何安装最新版本R语言详细介绍
在 Linux 系统上安装最新版本的 R 语言,不同的发行版有不同的安装方式,下面为你分别介绍在 Debian/Ubuntu 和 CentOS/RHEL 系统上的安装步骤。
在 Debian/Ubuntu 系统上安装
- 添加 CRAN 镜像:
打开终端,运行以下命令添加 CRAN 镜像源。bashupdatedirmngr gnupg apt-transport-https ca-certificates software-properties-common
apt-key adv keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB
add-apt-repository
这里的
focal指的是 Ubuntu 20.04,如果你使用的是其他版本,需要替换成对应的版本代号。 - 安装 R 语言:bash
updater-base
在 CentOS/RHEL 系统上安装
- 添加 CRAN 镜像:
打开终端,运行以下命令添加 CRAN 镜像源。bashyum https://dl.fedoraproject.org/pub/epel/epel-release-latest- .noarch.rpmyum-config-manager --add-repo https://cloud.r-project.org/bin/linux/centos/R.repo
- 安装 R 语言:bash
yum R
验证安装
安装完成后,你可以在终端输入 R 来启动 R 语言环境,如果成功进入 R 环境,则表示安装成功。
bash
R
当看到类似下面的输出,就说明 R 语言已经成功安装并启动了。
plaintext
R version 4.x.x (202x-xx-xx) -- "Some Nice Title"Copyright (C) 202x The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
>
991234567891011121380081920R version 4.x.x (202x-xx-xx) -- "Some Nice Title"Copyright (C) 202x The R Foundation for Statistical ComputingPlatform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.You are welcome to redistribute it under certain conditions.Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.Type 'contributors()' for more information and'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or'help.start()' for an HTML browser interface to help.Type 'q()' to quit R.
>
输入 q() 并回车即可退出 R 环境。