5

Title pretty much says it. I have epel installed and when I try to yum the new version, I get version 3.6.0.

I know it's possible to compile it from the source, but CRAN seems to want to steer me away from that (and I'm happy to oblige).

Caroline
  • 450
  • 1
  • 5
  • 15

3 Answers3

12

The RStudio documentation has a detailed tutorial on how to install almost any R version (including 4.X.X) on CentOS 7 & 8: https://docs.rstudio.com/resources/install-r/#optional-install-recommended-packages

In case the link is taken down, I detail here the steps for CentOS 7:

# Enable the Extra Packages for Enterprise Linux (EPEL) repository
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 

# On RHEL 7, enable the Optional repository
sudo subscription-manager repos --enable "rhel-*-optional-rpms"

# If running RHEL 7 in a public cloud, such as Amazon EC2, enable the
# Optional repository from Red Hat Update Infrastructure (RHUI) instead
sudo yum install yum-utils
sudo yum-config-manager --enable "rhel-*-optional-rpms"

# Download and install R
export R_VERSION=4.0.0
curl -O https://cdn.rstudio.com/r/centos-7/pkgs/R-${R_VERSION}-1-1.x86_64.rpm
sudo yum install R-${R_VERSION}-1-1.x86_64.rpm

# Verify installation
/opt/R/${R_VERSION}/bin/R --version

# Create symlink to R
sudo ln -s /opt/R/${R_VERSION}/bin/R /usr/local/bin/R
sudo ln -s /opt/R/${R_VERSION}/bin/Rscript /usr/local/bin/Rscript
Hoter
  • 155
  • 1
  • 7
  • `Error: Package: R-4.0.0-1-1.x86_64 (/R-4.0.0-1-1.x86_64) Requires: openblas-devel You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest` – PesKchan Feb 11 '23 at 07:40
1

The default channel does not store the latest version of R. Fortunately, you can get the latest version of R through the conda-forge channel. Therefore, you should add this channel first.

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
conda config --set show_channel_urls yes
conda search R
conda install R
pengchy
  • 732
  • 2
  • 14
  • 26
  • While this code may solve the question, [including an explanation](//meta.stackexchange.com/q/114762) of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please [edit] your answer to add explanations and give an indication of what limitations and assumptions apply. – double-beep Dec 07 '20 at 11:07
0

I was able to get R version 4.0.2 using the script on this page:

https://www.osradar.com/how-to-install-r-and-rstudio-on-centos-8/

The only problem was that the instructions to fix the path weren't working for me, so I just changed it in RStudio Server.

Caroline
  • 450
  • 1
  • 5
  • 15