How to install newer version of R on Amazon Linux 2 - r

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!

Use amazon-linux-extras which installs R4.0.2:
amazon-linux-extras install R4
You may need root:
sudo amazon-linux-extras install R4

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.

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

Related

Are packages deleted when upgrading R on Linux?

Are packages deleted when upgrading R on Linux? I would prefer to just use the default package installation directory, instead of setting up a custom directory.
I'm aware I can setup a custom directory in the following manner:
cat >> ~/.Renviron
R_LIBS=/data/Rpackages/
I just wonder what happens if I don't issue the command above? Will packages be wiped every time I issue the command
sudo apt-get update && sudo apt-get upgrade
, and as a consequence R gets updated to the latest version?
#Jason, when you are doing sudo apt-get update && sudo apt-get upgrade, it just upgrade packages that have a new version in your list of repositories. There is no reason it will modify R packages already installed.
I'm also running Linux and R and the only time I have to re-install R packages is when I re-install my system. My R packages are installed by default in /usr/local/lib/R/site-library

Installing R packages on Amazon Linux EC2 instance

I am learning to use RSelenium in an EC2 instance, and I found this handy guide on doing so - https://rpubs.com/grahamplace/rselenium-ec2 - however the guide focuses on an Ubuntu instance and I am using an Amazon Linux Instance. In order to install RSelenium, the guide says I must externally (outside of R but ssh'd into my EC2 instance) install the packages xml (XML i think, case sensitive) and RCurl. The guide's relevant lines of code are:
sudo apt-get install r-cran-xml
sudo apt-get install r-cran-RCurl
however, since I'm in an Amazon Linux instance, I tried:
sudo yum install r-cran-xml
sudo yum install r-cran-RCurl
for which I get the following error:
No package r-cran-RCurl available.
Error: Nothing to do
Note: I was successful in installing R on my machine (my instance), and I am able to simply type R to launch R in the EC2 instance.
Note2: install.packages('XML') and install.packages('RCurl') with R launched do not work either.
Any help appreciated with this, thanks!
the amazon linux R package has a different name:
sudo yum install -y R
then you tried (in R) install.packages(c('XML','RCurl')), but the installation failed.
as you discovered and describe in the comment below, you needed to install an additional amazon linux package, libxml2-devel, in order to install.packages('XML') successfully.
this is what I get when I run sudo yum install -y R
No package R available.
Error: Nothing to do
R is available in Amazon Linux Extra topic "R3.4"
To use, run
sudo amazon-linux-extras install R3.4
Learn more at
https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras

Install R latest verison on ubuntu 16.04

So I tried to install R (after repairing ubuntu on my system) using following command :
sudo apt-get install r-base-core
sudo apt-get install r-recommended
It installs R 3.2 , but the latest version of R currently available to use is R 3.4, any idea why it is not installing R 3.4 ?
I lately installed R.3.4 manually, it works fine. just curious to know why it didn't installed at the first place using the command.
Follow these steps:
Add this entry deb https://cloud.r-project.org/bin/linux/ubuntu xenial/ to your /etc/apt/sources.list file.
Run this command in shell: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9.
Update and install: sudo apt update; sudo apt install r-base.
I wrote a post that explains each step in detail (update: also covers installing R on Ubuntu 18.04); here's the link.
It installs 3.2 because that's the default in the Ubuntu 16.04 repository. If you want the most up to date version of R for Ubuntu it's best to follow the instructions at the cran page for R on Ubuntu.
The xenial-cran35/ version of the repo does NOT work if you have a "default release" set in apt, as is the case in some distros that work on top of Ubuntu, such as Mint. For my Mint distro, there exists a file /etc/apt/apt.conf.d/01ubuntu inside of which it declares the Default-Release "xenial"; What this means is that, since r-base exists in the ubuntu repo at version 3.2, with release "xenial", it'll never use the 3.6 branch from the other repo, because the release name for that repo is "xenial-cran35". You need to edit that file to change the default release to "xenail-cran35", or do something more pointed using apt preference files (https://wiki.debian.org/AptPreferences#A.2Fetc.2Fapt.2Fpreferences).
This is basically R's fault for having a poorly formatted repo. They should have had 2 repos, each of which had a "xenial" release folder, one url for their 3.2 branch work and one for the 3.5+ branch work. Instead they have one repo, and have bastardized the "release name" instead, which just sort of happens to work for base Ubuntu, but won't work if you have non-base configuration of apt in this way.

How to install a specific version of nginx on Debian 7?

I did the following to nstall nginx on Debian 7
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install nginx
sudo service nginx start
This installed the latest version of nginx , How do I install another version?
Doing sudo apt-get install nginx=1.2 or sudo apt-get install nginx-1.2 does not work. It fails saying version not found?
Older version of Nginx is not available in Debian repository, you need configure Nginx Debian repository http://nginx.org/en/linux_packages.html or find the deb package and install manually.
A distribution of Debian is a set of software packages that was tested to run well together. Every change imposes a risk to break somethign somewhere since that change may not have been prepared for by another software also installed.
When you are for a newever version than what the distributions ships, then a look at the package "tracker" will present an overview of what is currently available, which includes so-called backports to your distribution: https://packages.qa.debian.org/n/nginx.html but indeed the packages directly provided by nginx.org should be just fine. For looks into the past, check out http://snapshot.debian.org/package/nginx/ .

How to upgrade Atom Editor on Linux?

What is the best way to upgrade atom on Linux Ubuntu ?
I install atom using official doc
git clone https://github.com/atom/atom
cd atom
script/build
sudo script/grunt install
I created the following script to update my atom on Ubuntu 14.10.
#!/bin/bash
# Update atom from downloaded deb file
rm -f /tmp/atom.deb
curl -L https://atom.io/download/deb > /tmp/atom.deb
dpkg --install /tmp/atom.deb
echo "***** apm upgrade - to ensure we update all apm packages *****"
apm upgrade --confirm false
exit 0
The file atom_update is executable and needs to be called using su:
sudo ./atom_update
The above works, but nowadays I use the following:
sudo add-apt-repository -y ppa:webupd8team/atom
sudo apt -y update
sudo apt -y install atom
apm install \
file-icons \
tabs-to-spaces \
trailing-spaces \
xml-formatter
With the above setup
sudo apt -y upgrade
will update an installed atom to the latest version. The ppa is generally up to date.
Now, it looks like the easiest way is to download the new packaged version (.deb or .rpm) from the official releases and install it over your previous one: https://github.com/atom/atom/releases
It's now even easier with the APT package.
sudo add-apt-repository ppa:webupd8team/atom
sudo apt update
sudo apt install atom
And now you can upgrade / dist-upgrade as usual
sudo apt upgrade
Current official documentation seem to recommend another method:
Atom Github Page
Debian Linux (Ubuntu)
Atom is only available for 64-bit Linux systems.
Download atom-amd64.deb from the Atom releases page.
Run sudo dpkg --install atom-amd64.deb on the downloaded package.
Launch Atom using the installed atom command.
The Linux version does not currently
automatically update so you will need to repeat these steps to upgrade
to future releases.
Red Hat Linux (Fedora 21 and under, CentOS, Red Hat)
Atom is only available for 64-bit Linux systems.
Download atom.x86_64.rpm from the Atom releases page.
Run sudo yum localinstall atom.x86_64.rpm on the downloaded package.
Launch Atom using the installed atom command.
The Linux version does not currently
automatically update so you will need to repeat these steps to upgrade
to future releases.
Fedora 22+
Atom is only available for 64-bit Linux systems.
Download atom.x86_64.rpm from the Atom releases page.
Run sudo dnf install ./atom.x86_64.rpm on the downloaded package.
Launch Atom using the installed atom command.
The Linux version does not currently
automatically update so you will need to repeat these steps to upgrade
to future releases.
As of this writing, the best option to upgrade to the latest released version of Atom is to check out the most recent tag and build it, especially if you built it in the first place.
cd atom
git pull
git checkout v0.115.0 (or whatever the latest release is: https://github.com/atom/atom/releases)
script/build
sudo script/grunt install
wget https://atom.io/download/deb -O atom64.deb
sudo dpkg --install atom64.deb
or
wget https://atom.io/download/rpm -O atom64.rpm
sudo dnf install atom64.rpm
the above URLs redirect to https://atom-installer.github.com/
An easier way is to install the atom-updater-linux from the packages on the atom website.
Go to edit > preferences > install and search for atom-updater-linux
or from the terminal:
apm install atom-updater-linux
This should check for updates after every launch and prompt you to install new updates.
Currently the preferred procedure is described at the atom pages Installing Atom - Platform-linux
When using the add-apt-repository suggested in the top answer, this URL is suggested.
The apt repository mentioned at the Atom pages:
curl -sL https://packagecloud.io/AtomEditor/atom/gpgkey | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] https://packagecloud.io/AtomEditor/atom/any/ any main" > /etc/apt/sources.list.d/atom.list'
sudo apt-get update
If you are onn Ubuntu you can go to the Ubuntu Software Center, search for Atom and just click on Update. Then job done!
If anybody is interested, I wrote a small atom package for this purpose.
The package is meant to timely inform the user of new versions being available (stable or beta, configurable via settings) and uses GitHub API under the hood. It is platform independent, so it should work with any linux distro, but also with Windows or other systems.
It does not perform the upgrade automatically as I wrote it for my needs and I was not interested in such feature. I may add it in the future should strong interest for it manifest itself, though.
Feedback is welcome, best as tickets on github.
I upgraded from
Atom : 1.26.1
Electron: 1.7.11
Chrome : 58.0.3029.110
Node : 7.9.0
to
Atom : 1.40.1
Electron: 3.1.10
Chrome : 66.0.3359.181
Node : 10.2.0
I followed these simple steps,
create a file
sudo nano /usr/local/bin/atom-update
copy following snippet and save with Ctrl+o and "enter" and Ctrl+x
your code
#!/bin/bash
wget -q https://github.com/atom/atom/releases/latest -O /tmp/latest
wget --progress=bar -q 'https://github.com'$(cat /tmp/latest | grep -o -E 'href="([^"#]+)atom-amd64.deb"' | cut -d'"' -f2 | sort | uniq) -O /tmp/atom-amd64.deb -q --show-progress
dpkg -i /tmp/atom-amd64.deb
Make it executable
sudo chmod +x /usr/local/bin/atom-update
Run the script to upgrade atom
sudo atom-update
Ubuntu 16.04 and later
Run these commands to quickly and easily install and upgrade the Atom text editor snap package from the terminal in Ubuntu 16.04 and later (64-bit only).
Install Atom text editor:
sudo snap install --classic atom
Note that a snap in classic confinement behaves as a traditionally packaged application with full access to the system, and Atom extension packages are installed into the user's home directory.
Upgrade Atom text editor:
sudo snap refresh --classic atom
I would add that you should probably clean before updating the build to prevent some nasty errors.
cd atom
git pull
script/clean
script/build
sudo script/grunt install
For debian I have created a bash script which does the following:
Check with https://api.github.com and dpkg if atom is installed and/or up-to date.
Download and install the atom.deb from github if needed.
Provide a --beta switch if somebody wants to maintain the beta version as well.
Fell free to use it, it is located here: https://gist.github.com/rumpelsepp/8a953d6c092cbeb043695cfada114bef
Since December 2017 Atom provides official repositories for all major Linux distributions. You can find the latest installation instructions here.
Latest Way is to first install $ apm install atom-updater-linux then simply press Alt+Ctrl+U or go to Help and there is option for check for updates

Resources