Installing R on Rhel 6

Installing R 3.3.2 in RHEL 6.8 without yum

GCC does come with a Fortran compiler - gfortran, but the Fortran part is often moved to a different package which is not installed by default. This is distribution specific.

In RHEL this package should be called gcc-gfortran. RHEL notoriously ships very old versions of GCC but R should be compatible with them anyway. See installation of compiler gfortran in centos 6

You should have access to the RHEL rpm repositories included in your RHEL subscription. You should also be able to use the CentOS binary http://mirror.centos.org/centos/6/os/x86_64/Packages/gcc-gfortran-4.4.7-17.el6.x86_64.rpm from http://mirror.centos.org/centos/6/os/x86_64/Packages/

Just download the rpm file, copy it to your computer on a floppy disk or USB or whatever and install by rpm -i or yum. It is trivial and yum does work even in computers without internet access. Just download the rpm and copy it there.

Of course, you can always install a complete new version of GCC, be it from an rpm binaries or from sources from https://gcc.gnu.org/releases.html Just follow the instructions in the documentation.

Install R 3+ on Redhat 6.3

This is likely due to there being R RPMs in the Extra Packages for Enterprise Linux (EPEL) repos for RHEL6. You can find out more about EPEL on the Fedora website.

You need to configure yum to use EPEL. The easiest way to do this is to install the epel-release package for your platform, eg

su -c 'rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm'

or

su -c 'rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm'

for example. The you can use yum to install R, e.g. you will probably want

su -c 'yum install R R-core R-core-devel R-devel'

so that you pull in the packages needed to build other add-on packages as most CRAN package are not in EPEL.

At the moment, the latest version of R in EPEL is 3.0.1, so one patch release point behind the latest version 3.0.2.

How to update to specific R version on Linux (Red Hat/CentOS), keeping the previous version?

Question 1: I'm not sure why, but having multiple versions of R on your PATH can lead to unexpected situations like this. /usr/local/bin is usually ahead of /usr/bin in the PATH, so I would've expected R 3.6.3 to be found. Perhaps it has to do with Question 2.

Question 2: Some distros (like CentOS/RHEL) don't put /usr/local/bin on the PATH by default when using sudo. See https://unix.stackexchange.com/questions/8646/why-are-path-variables-different-when-running-via-sudo-and-su for details. The answers there describe several ways to add /usr/local/bin to the PATH when using sudo -- for example, modifying secure_path in /etc/sudoers to include /usr/local/bin like:

Defaults    secure_path = /usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

With R 3.6.3 ahead of the default system R in the PATH, you shouldn't have to delete /bin/R or /usr/bin/R. But eventually, I'd recommend installing multiple side-by-side versions of R the same way, using https://docs.rstudio.com/resources/install-r/, so it's easier to manage. The next time you install a new R version, you can just replace the symlinks in /usr/local/bin. The default system R (from EPEL) is meant to be the only R on a system, with in-place upgrades.

If you want to replace the default R 3.5.2 with a side-by-side R 3.5.2 (or 3.5.3), you could install R 3.5 from https://docs.rstudio.com/resources/install-r/, install all necessary packages, and have Shiny Server use the new R 3.5. Then uninstall the R from EPEL (R-core or R-core-devel) to fully switch over. From there, you could even create symlinks to R in /usr/bin instead of /usr/local/bin, and not worry about adding /usr/local/bin to the sudo PATH.



Related Topics



Leave a reply



Submit