8

For whatever reason, Amazon moved R to the so-called "Extras Library" so you can't install R using sudo yum install -y R anymore. Instead, you have to do sudo amazon-linux-extras install R3.4. As a result, I can only install R 3.4.3 when the newest stable release is 3.6.1, and so many R libraries can't even be installed because the version is too low. Is there any good and clean way to install the latest version of R and skip Amazon's package manager? Thanks!

Vince
  • 305
  • 1
  • 3
  • 7

3 Answers3

11

Use amazon-linux-extras which installs R4.0.2:

amazon-linux-extras install R4

You may need root:

sudo amazon-linux-extras install R4
user890739
  • 702
  • 1
  • 13
  • 33
  • It looks like `amazon-linux-extras` might wrap `yum`; I had to `sudo su -` before I could run it as running just with `sudo` still ran `yum` as my current user (and thus failed). – Tim Malone Mar 21 '22 at 06:06
1

Try this on Amazon Linux 2

yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install R

Amazon Linux 2 Image contains extras library that can be used as well. Follow the guide here.

https://aws.amazon.com/premiumsupport/knowledge-center/ec2-install-extras-library-software/

sudo amazon-linux-extras enable R3.4
sudo yum clean metadata && sudo yum install R3.4
rhlarora84
  • 67
  • 6
1

I've tried setting up R 3.6.x on a docker container that uses the amazonlinux image. My approach was to get the R source file from the below link and install from source

cd /tmp/ 
wget https://cloud.r-project.org/src/base/R-3/R-3.6.3.tar.gz
tar -zxf R-3.6.3.tar.gz
cd /tmp/R-3.6.3
./configure --without-libtiff --without-lapack --without-ICU --disable-R-profiling --disable-nls
make
make install

you will need to yum install some dependencies, like 'make', which doesn't seem to come with aws amazonlinux docker image (which i think mirrors the EC2 instance AMI image you are referring to).

The above kind of worked for me in that i had a working R3.6 installation, but it didnt allow me use it with rshiny server, so i'm reverting to the shipped 3.4.3 version.

tl;dr: you'll probably have to manually download the source files and install the desired R version from source, and throw in some build dependencies as well.

bettmensch
  • 11
  • 2