Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install newer version of R on Amazon Linux 2

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!

like image 513
Vince Avatar asked Dec 19 '19 19:12

Vince


People also ask

How do I update R on AWS?

Remove the old version of R. Back in the shell, add the public keys. Update the package list and install the new base R package. When you launch R you should find that it is the sparkling new version.

What version is Amazon Linux 2?

Linux kernel 4.19 is available. Linux kernel 4.19 was made available in Amazon Linux 2 Extras channel. For more information, see Amazon Linux 07/18/2019 release notes.

Does Amazon Linux 2 have AWS CLI?

AWS integrationAmazon Linux 2 comes with many AWS tools (e.g. AWS CLI) and cloud-init. These tools are designed to simplify the scripting of common administration tasks from within an instance and enable remote configuration of instances.

How to upgrade the default Linux kernel installed on Amazon Linux 2?

The default kernel installed on Amazon Linux 2 instances is 4.14.x. You can upgrade the default kernel to an Amazon Linux Extras kernel version 5.4.x, Or, if you have kernel version 5.4.x installed, you can upgrade to version 5.10.x. 1. Review the current active kernel version.

How do I install multiple versions of R on RedHat?

Installing additional versions of R side-by-side with the system version requires building R from source but is very straightforward. First, ensure that you have the build dependencies required for R. On RedHat/CentOS you’d use this command: $ sudo yum-builddep R.

How do I install R on Red Hat Linux?

First, ensure that you have the build dependencies required for R. On RedHat/CentOS you’d use this command: On Debian/Ubuntu systems you’d use this command: Once you’ve satisfied the build dependencies, you should obtain and unarchive the source tarball for the version of R you want to install.

How do I update R to the latest version?

One way is to run the actual R program. There, you can go to the “R” menu and click “Check for R Updates” (see image below). If you do that, R will tell you the current version you’re on, and whether or not there is a more updated version that you can download (circled in blue).


3 Answers

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

amazon-linux-extras install R4

You may need root:

sudo amazon-linux-extras install R4
like image 101
user890739 Avatar answered Oct 19 '22 19:10

user890739


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.

like image 1
bettmensch Avatar answered Oct 19 '22 21:10

bettmensch


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
like image 1
rhlarora84 Avatar answered Oct 19 '22 20:10

rhlarora84