How to upgrade R version on AWS EC2 instance?

Viewed 2175

Quite surprisingly it's hard to find a workable solution around this.

I have an EC2 instance launched with Ubuntu 18.04 distribution.

I do sudo-get install r-base but the installed R version is R3.4

I've followed the steps here below where it asks to edit the source.list file https://cran.r-project.org/bin/linux/ubuntu/README.html#installation

However, AWS declines the update as the source link is not secured.

2 Answers

Have you made sure you succesfully added the public key to the system?

This has worked for me fine in EC2 Ubuntu 18.04 to update to R 3.6.1. I also followed instructions given in https://cran.r-project.org/bin/linux/ubuntu/README.html#installation.

First, add the public key in the documentation´s "Secure APT" section. Run this in terminal:

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

Next, add modify your file /etc/apt/source.list by entering this command:

$ sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'

Once that is done, enter this command and double check if AWS has not declined the update

$ sudo apt update

Finally, run this to get updates installed

$ sudo apt install r-base r-base-dev

I found this resource to be very helpful: https://www.charlesbordet.com/en/shiny-aws-3/#how-to-install-shiny-server

I ended up using AMI from this website louisaslett.com/RStudio_AMI/

It has some pre-builts libraries and installations.

Related