在AWS EC2 Linux AMI上安装R和RStudio - 安装最新版本的R

3

亚马逊提供了一个清晰的安装指南,用于启动微实例和安装R & RStudio。该指南可以在此处找到:https://aws.amazon.com/blogs/big-data/running-r-on-aws/

不幸的是,这会安装较旧版本的R(3.2.2),对某些软件包(如slam)造成问题,因为它们需要R版本> 3.3.1

在更改用户数据的步骤的指南中,他们提供了以下脚本,其中涵盖了安装R和RStudio的过程。我如何更改脚本以安装最新版本的R?

#!/bin/bash
#install R
yum install -y R
#install RStudio-Server
wget https://download2.rstudio.org/rstudio-server-rhel-0.99.465-x86_64.rpm
yum install -y --nogpgcheck rstudio-server-rhel-0.99.465-x86_64.rpm
#install shiny and shiny-server
R -e "install.packages('shiny', repos='http://cran.rstudio.com/')"
wget https://download3.rstudio.org/centos5.9/x86_64/shiny-server-1.4.0.718-rh5-x86_64.rpm
yum install -y --nogpgcheck shiny-server-1.4.0.718-rh5-x86_64.rpm
#add user(s)
useradd username
echo username:password | chpasswd

谢谢


直接从CRAN安装?请参见https://www.r-bloggers.com/setting-up-an-aws-instance-for-r-rstudio-opencpu-or-shiny-server/。 - chinsoon12
你也可以使用Docker来安装最新版本。https://hub.docker.com/r/rocker/rstudio/ - PinkFluffyUnicorn
嗨chinsoon,谢谢你提供的参考。不过该博客仅涵盖Ubuntu而非Linux。 - New_code
1个回答

3

请试试这个:

# Install r-base
yum install r-base

# Install newest version of R from source
 wget https://cran.r-project.org/src/base/R-3/R-3.4.0.tar.gz
./configure --prefix=/home/$user/R/R-3.4.0 --with-x=yes --enable-R-shlib=yes --with-cairo=yes
make
# NEWS.pdf file is missing and will make installation crash.
touch doc/NEWS.pdf
make install

# Do not forget to update your PATH
export PATH=~/R/R-3.4.0/bin:$PATH
export RSTUDIO_WHICH_R=~/R/R-3.4.0/bin/R

我从一个Ubuntu R安装指南中找到了这个内容:http://jtremblay.github.io/software_installation/2017/06/21/Install-R-3.4.0-and-RStudio-on-Ubuntu-16.04


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接