Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.
- 📢 welcome to like: 👍 collect ⭐ message 📝 if there are mistakes please correct, give people rose, hand left lingering fragrance!
- 📢 This article was originally written by Webmote and originally published by Nuggets.
- 📢 author’s motto: life is toss about, when you don’t toss about life, life will start to toss about you, let us come on together! 💪 💪 💪
1. Installing R is a problem
Why this article? Because RedHat’s warehouse source does not include R, installing R is a problem.
Quite a few articles on the web are installed in CentOS, which is very easy compared to RedHat8. Most of the RedHat installations don’t work properly, hence this article.
Of course, compared to direct install, the latter two methods need more operations, are not convenient, but it is the most convenient step at present.
R software packages are not included in the CentOS 8 core software source. We need to install R from the EPEL software source.
To install R on CentOS 8, perform the following steps:
01. Enable EPEL and PowerTools
sudo dnf install epel-release
sudo dnf config-manager --set-enabled PowerTools
Copy the code
02. Installation R:
sudo yum install R
Copy the code
03. Verify successful installation and print version R:
R --version
Copy the code
2. Installation Method 1
Install ePEL first.
#Install ePEL extension repository, most likely not, not to change the next line, from the specified Ari cloud install.
sudo yum install epel-release -y
#Or manually download the RPM package
sudo yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
#After epel is installed, files starting with epel will be added to '/etc/yum-pos. d' directory
sudo dnf install epel-release
Copy the code
Configure the PowerTools source sudo vi /etc/ym.repos. d/ centos-powertools. repo Set the following parameters:
# CentOS-PowerTools.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[PowerTools]
name=CentOS-$releasever - PowerTools
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=PowerTools&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/PowerTools/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
Copy the code
Additional rpmKey:
rpmkeys --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official
Copy the code
Activate PowerTools:
# dnf list --enablerepo PowerTools
# dnf config-manager --set-enabled PowerTools
Copy the code
Install R:
sudo yum install R -y
Copy the code
Verify the installation
$ R --version
R version 4.1.1 (2021-08-10) -- "Kick Things"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.
Copy the code
3 Installation Method 2
Install the EPEL first by referring to the above installation or the following installation:
--- CentOS 8 ---
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf config-manager --set-enabled PowerTools
--- RHEL 8 ---
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo ARCH=$( /bin/arch )
sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-${ARCH}-rpms"
Copy the code
Direct mounting R
sudo bash -c "$(curl -L https://rstd.io/r-install)"
Copy the code
Type the version you want to install, for example, 4.1.1
After installation, print the version: ${R_VERSION} and replace it with the version you installed.
/opt/R/${R_VERSION}/bin/R --version
Copy the code
Add R to the PATH environment variable.
Sudo vi ~/.bashrc, add:
The export PATH = $PATH: / opt/R / 4.4.1 / bin /Copy the code
Compile the file to take effect.
$ sudo source .bashrc
$ which R/ 3.6.3 / bin/opt/R/R
$ R --version
Copy the code
Nodule 8.
It took me a while to install R, so let me write it down.
👓 have seen this, but also care about a thumbs-up?
👓 has been liked, but also care about a collection?
👓 are collected, but also care about a comment?