简体   繁体   中英

R on Amazon EC2 (RedHat/Centos instance)

To set up R & RStudio Server & Shiny (Server) on Amazon EC2 is straightforward, see https://blogs.aws.amazon.com/bigdata/post/Tx3IJSB6BMHWZE5/Running-R-on-AWS . This will set up a Amazon Linux instance (RedHat/CentOS).

When specifying the following details in "Step 3: Configure Instance Details" --> "Advanced Details", R & RStudio are automatically installed:

#!/bin/bash
#install R
yum install -y R

#install RStudio-Server
wget https://download2.rstudio.org/rstudio-server-rhel-0.99.903-x86_64.rpm
yum install -y --nogpgcheck rstudio-server-rhel-0.99.903-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.2.786-rh5-x86_64.rpm
yum install -y --nogpgcheck shiny-server-1.4.2.786-rh5-x86_64.rpm 

#add user(s)
useradd username
echo username:password | chpasswd

However, the installed R version is outdated (ie R 3.2.5). How, to change this command to ensure that the latest R version gets installed?

First log on as root in the terminal

 sudo /bin/bash

The remove the old installed version of R

apt-get remove r-base-core

Edit /etc/apt/sources.list with nano /etc/apt/sources.list and add the following:

deb http://cran.rstudio.com/bin/linux/ubuntu trusty/

In the terminal add the publick keys with:

gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
gpg -a --export E084DAB9 | apt-key add -

At the end update and upgrade the package list

 apt-get update
 apt-get upgrade

Now you have to install the new version of R with:

 apt-get install r-base

If you want to update the package in your library you can run update.packages indicating the path to where your libraries are stored.

[Update CentOS] Have you tried to update the repository

sudo rpm -Uvh http:/www.nic.funet.fi.pub/mirrors/fedora.redhat.com/pub/epel/5/x86_64/epel-release-latest-7.noarch.rpm

And then sudo yum installal R ?

Just like the previous part of the answer, if you have problem you need to remove all the installed component of R and then installed with the updated repo: sudo yum remove

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM