Ubuntu 16.04 安装 R 环境

本文介绍了如何在Ubuntu 16.04上安装R和R-Studio,包括添加R仓库、安装R基础包及R-Studio的详细步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

How to Install R on Linux Ubuntu 16.04

原文:https://www.datascienceriot.com/how-to-install-r-in-linux-ubuntu-16-04-xenial-xerus/kris/

The long-awaited new Ubuntu LTS Xenial Xerus was released last week. I wrote a tutorial on installing R and R-Studio on the old 14.04 LTS, so I figured I’d update that document. Not much has changed for the new 16.04 version but there are new repositories.

Install R-Base

You can find R-Base in the Software Center; this would be the easy way to do it. However, the Software Center versions are often out of date, which can be a pain moving foward when your packages are based on the most current version of R Base. The easy fix is to download and install R Base directly from the Cran servers.

  1. Add R repository

First, we’ve got to add a line to our /etc/apt/sources.list file. This can be accomplished with the following. Note the “xenial” in the line, indicating Ubuntu 16.04. If you have a different version, just change that.

sudo echo “deb http://cran.rstudio.com/bin/linux/ubuntu xenial/” | sudo tee -a /etc/apt/sources.list

  1. Add R to Ubuntu Keyring

First:

gpg –keyserver keyserver.ubuntu.com –recv-key E084DAB9

Then:

gpg -a –export E084DAB9 | sudo apt-key add -

  1. Install R-Base

Most Linux users should be familiar with the old…

sudo apt-get update
sudo apt-get install r-base r-base-dev

Installing R-Studio

RStudio is not currently in the Software Center, but it can easily be installed manually:

sudo apt-get install gdebi-core
wget https://download1.rstudio.org/rstudio-0.99.896-amd64.deb
sudo gdebi -n rstudio-0.99.896-amd64.deb
rm rstudio-0.99.896-amd64.deb

### 安装 RStudio on Ubuntu 16.04 为了在Ubuntu 16.04上成功安装RStudio,可以遵循如下方法: 对于桌面版的RStudio安装,先通过命令行工具`gdebi-core`来简化`.deb`包的依赖关系处理。具体操作为使用`sudo apt-get install gdebi-core`完成`gdebi-core`软件包的安装[^1]。 之后,从[RStudio官方网站](https://www.rstudio.com/products/rstudio/download/)下载适合系统的RStudio版本。如果已经下载了特定版本如`rstudio-1.0.44-amd64.deb`,那么可以通过执行`sudo gdebi -n rstudio-1.0.44-1.0.44-amd64.deb`实现。 针对服务器环境下的RStudio (即RStudio Server),同样需要准备`gdebi-core`用于解决依赖项问题。接着,根据系统架构(32位或64位)选择合适的RStudio Server `.deb`包进行下载并利用`gdebi`指令完成部署工作。例如,在32位系统上的命令流程将是这样的:`wget https://download2.rstudio.org/rstudio-server-1.1.419-i386.deb`获取安装包后,再用`sudo gdebi rstudio-server-1.1.419-i386.deb`实施安装过程[^2]。 值得注意的是,由于官方可能停止对较老版本Linux发行版的支持,当遇到新版本不兼容的情况时,则应该寻找历史存档中的旧版本进行安装[^3]。 ```bash # 更新软件源列表 $ sudo apt update # 安装GDebi包管理器 $ sudo apt-get install gdebi-core # 下载RStudio Desktop/Server .deb 文件至当前目录(替换URL为你所选版本) $ wget URL_TO_RSTUDIO_DEB_FILE # 使用GDebi安装RStudio $ sudo gdebi downloaded_rstudio_package_name.deb # 清理临时下载的.deb文件 $ rm downloaded_rstudio_package_name.deb ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值