The newest R release (including recommended packages as well as development headers and tools) can be installed by running
$ sudo dnf install R
or yum
instead of dnf
for older EPEL versions. This ‘R’ RPM is a meta-package. It has no content but ensures that the following components are installed
Component | Description |
---|---|
R-core | The minimal R components necessary for a functional runtime |
R-core-devel | Core files for development of R packages (no Java) |
R-java | R with Fedora-provided Java Runtime Environment |
R-java-devel | Development package for use with Java enabled R components |
libRmath | Standalone math library from the R project |
libRmath-devel | Headers from the R standalone math library |
This division enables minimal installations (e.g., with no Java, with no development tools…), but generally R users will need all the components to be able to install any package from source. Therefore, it is recommended to install the ‘R’ meta-package.
The Fedora RPMs for R have been ported to CentOS/RHEL by the project Extra Packages for Enterprise Linux (EPEL). These RPMs are also compatible with distributions derived from CentOS/RHEL.
To use the EPEL repository, it is sufficient to download and install the appropriate “epel-release” RPM, as described in the EPEL FAQ. Then R can be installed as described above.
The R installation is divided in two directories:
/usr/lib/R
(/usr/lib64/R
in 64-bit architectures) contains R binaries and libraries./usr/share/R
contains documentation, licenses and other non-binary files.In the same way,
/usr/lib/R/library
(/usr/lib64/R/library
in 64-bit architectures) contains system-provided packages with binary code./usr/share/R/library
contains system-provided packages without binary code.Additionally, the R installation adds the following paths:
/usr/local/lib/R/library
(the same for 64-bit architectures), which is not used by any package in the official repositories./home/<user>/R/<architecture>-redhat-linux-gnu-library/<version>
, which is the destination for any package installed from the R console using install.packages
.For example, these are the library paths for a x86_64 machine with R 4.0 installed:
.libPaths()
#> [1] "/home/<user>/R/x86_64-redhat-linux-gnu-library/4.0"
#> [2] "/usr/local/lib/R/library"
#> [3] "/usr/lib64/R/library"
#> [4] "/usr/share/R/library"
Recommended R packages are included as part of the R-core component. A number of add-on packages from CRAN, Bioconductor and other sources are readily available via the official repositories. Hence, running
$ dnf repoquery --repo=fedora-source R-*
provides a comprehensive list.
The listing below shows all RPMs available for R packages on Fedora Linux 36 (Thirty Six), classified by the R repository that would normally be used to install the package from within R (see the help page ?chooseRepositories
).
## $CRAN
## [1] "abind" "acepack" "ape"
## [4] "argon2" "arules" "ascii"
## [7] "askpass" "assertthat" "AUC"
## [10] "backports" "base64enc" "bench"
## [13] "Bessel" "biglm" "bindr"
## [16] "bindrcpp" "bit" "bit64"
## [19] "bitops" "blob" "bookdown"
## [22] "brew" "brio" "broom"
## [25] "bslib" "cachem" "Cairo"
## [28] "callr" "car" "caTools"
## [31] "cellranger" "chron" "cli"
## [34] "cliapp" "clipr" "clisymbols"
## [37] "coda" "colorspace" "combinat"
## [40] "commonmark" "conflicted" "corpus"
## [43] "covr" "cpp11" "crayon"
## [46] "credentials" "crosstalk" "curl"
## [49] "cyclocomp" "data.table" "date"
## [52] "DBI" "DBItest" "dbplyr"
## [55] "debugme" "deldir" "desc"
## [58] "devtools" "dichromat" "diffobj"
## [61] "digest" "disposables" "doMC"
## [64] "doParallel" "downlit" "dplyr"
## [67] "DT" "dtplyr" "ellipsis"
## [70] "errors" "evaluate" "expm"
## [73] "fansi" "farver" "fastmap"
## [76] "fastmatch" "filehash" "filelock"
## [79] "flexiblas" "FMStable" "foghorn"
## [82] "fontBitstreamVera" "fontLiberation" "forcats"
## [85] "foreach" "formatR" "formattable"
## [88] "fortunes" "fs" "futile.logger"
## [91] "futile.options" "future" "gamlss.dist"
## [94] "gapminder" "gargle" "gdata"
## [97] "gdtools" "gee" "geepack"
## [100] "generics" "gert" "getPass"
## [103] "ggplot2" "ggplot2movies" "gh"
## [106] "git2r" "gitcreds" "globals"
## [109] "glue" "gmailr" "gmp"
## [112] "gplots" "gsl" "gss"
## [115] "gtable" "gtools" "haven"
## [118] "here" "hexbin" "highlight"
## [121] "highr" "hms" "htmltools"
## [124] "htmlwidgets" "httpuv" "httr"
## [127] "hunspell" "igraph" "import"
## [130] "ini" "inline" "IRdisplay"
## [133] "IRkernel" "isoband" "iterators"
## [136] "itertools" "jose" "jpeg"
## [139] "jqr" "jquerylib" "jsonlite"
## [142] "keyring" "knitr" "labeling"
## [145] "lambda.r" "later" "lazyeval"
## [148] "lifecycle" "lintr" "listenv"
## [151] "littler" "lmodel2" "lmtest"
## [154] "lobstr" "lokern" "lpSolve"
## [157] "lubridate" "magick" "magrittr"
## [160] "mapproj" "maps" "mAr"
## [163] "markdown" "matrixStats" "measurements"
## [166] "memoise" "microbats" "microbenchmark"
## [169] "mime" "miniUI" "mlbench"
## [172] "mnormt" "mockery" "mockr"
## [175] "modelr" "msm" "multcomp"
## [178] "munsell" "mvtnorm" "nanotime"
## [181] "ncdf4" "NISTunits" "nycflights13"
## [184] "odbc" "openssl" "orcutt"
## [187] "oskeyring" "packrat" "pak"
## [190] "parallelly" "parsedate" "pbapply"
## [193] "pbdZMQ" "pdftools" "pillar"
## [196] "pingr" "pkgbuild" "pkgcache"
## [199] "pkgconfig" "pkgdown" "pkgload"
## [202] "plogr" "plyr" "png"
## [205] "poLCA" "polyclip" "polynom"
## [208] "praise" "presser" "prettycode"
## [211] "prettydoc" "prettyunits" "processx"
## [214] "procmaps" "profmem" "profvis"
## [217] "progress" "promises" "ps"
## [220] "purrr" "qcc" "qpdf"
## [223] "qtl" "quadprog" "quantities"
## [226] "R.cache" "R.devices" "R.methodsS3"
## [229] "R.oo" "R.rsp" "R.utils"
## [232] "R6" "ragg" "randomForest"
## [235] "rappdirs" "rcmdcheck" "RColorBrewer"
## [238] "Rcpp" "RcppCCTZ" "RcppDate"
## [241] "RCurl" "readr" "readxl"
## [244] "rematch" "rematch2" "remotes"
## [247] "repr" "reprex" "repurrrsive"
## [250] "reshape" "reshape2" "restfulr"
## [253] "reticulate" "rex" "rgdal"
## [256] "rgeos" "RhpcBLASctl" "rhub"
## [259] "RInside" "rjson" "rlang"
## [262] "rle" "rlecuyer" "RMariaDB"
## [265] "rmarkdown" "Rmpfr" "RODBC"
## [268] "roxygen2" "RPostgres" "rprintf"
## [271] "rprojroot" "rsconnect" "RSQLite"
## [274] "rstudioapi" "rsvg" "RUnit"
## [277] "rversions" "rvest" "sandwich"
## [280] "sass" "scales" "scatterplot3d"
## [283] "sciplot" "selectr" "servr"
## [286] "sessioninfo" "sfsmisc" "shiny"
## [289] "showtext" "showtextdb" "simmer"
## [292] "snow" "sodium" "sourcetools"
## [295] "sp" "spelling" "statnet.common"
## [298] "stringdist" "stringi" "stringr"
## [301] "styler" "svglite" "sys"
## [304] "sysfonts" "systemfit" "systemfonts"
## [307] "tesseract" "testit" "testthat"
## [310] "textshaping" "TH.data" "tibble"
## [313] "tidyr" "tidyselect" "tikzDevice"
## [316] "timeDate" "timeSeries" "tinytest"
## [319] "tinytex" "tkrplot" "tmvnsim"
## [322] "tufte" "tweenr" "udunits2"
## [325] "unitizer" "units" "unix"
## [328] "usethis" "utf8" "uuid"
## [331] "V8" "vcd" "vctrs"
## [334] "viridisLite" "waldo" "waveslim"
## [337] "wavethresh" "webfakes" "webp"
## [340] "websocket" "webutils" "wesanderson"
## [343] "whisker" "whoami" "winch"
## [346] "withr" "xfun" "XML"
## [349] "xml2" "xmlparsedata" "xopen"
## [352] "xtable" "yaml" "zeallot"
## [355] "zip" "zoo"
##
## $`BioC software`
## [1] "affyio" "AnnotationDbi" "Biobase"
## [4] "BiocFileCache" "BiocGenerics" "BiocIO"
## [7] "BiocParallel" "biomaRt" "Biostrings"
## [10] "BSgenome" "BufferedMatrix" "DelayedArray"
## [13] "DynDoc" "GenomeInfoDb" "GenomicAlignments"
## [16] "GenomicRanges" "IRanges" "KEGGREST"
## [19] "MatrixGenerics" "preprocessCore" "qvalue"
## [22] "Rhtslib" "Rsamtools" "rtracklayer"
## [25] "S4Vectors" "SummarizedExperiment" "tkWidgets"
## [28] "widgetTools" "XVector"
##
## $`BioC annotation`
## [1] "GenomeInfoDbData"
##
## $`R-Forge`
## [1] "abind" "Bessel" "bit" "bit64"
## [5] "brew" "car" "colorspace" "data.table"
## [9] "date" "dichromat" "digest" "doMC"
## [13] "doParallel" "expm" "foreach" "fortunes"
## [17] "gamlss.dist" "gdata" "gplots" "gtools"
## [21] "highlight" "htmltools" "iterators" "itertools"
## [25] "labeling" "lmodel2" "lokern" "matrixStats"
## [29] "msm" "multcomp" "mvtnorm" "NISTunits"
## [33] "pbapply" "randomForest" "Rcpp" "rgdal"
## [37] "rgeos" "Rmpfr" "sandwich" "scatterplot3d"
## [41] "stringi" "systemfit" "TH.data" "tikzDevice"
## [45] "timeDate" "timeSeries" "vcd" "waveslim"
## [49] "xtable" "zoo"
##
## $rforge.net
## [1] "Cairo" "base64enc" "brew" "evaluate" "fastmatch"
## [6] "formatR" "highr" "jpeg" "knitr" "markdown"
## [11] "mime" "png" "servr" "testit" "tikzDevice"
## [16] "uuid"
##
## $Other
## [1] "RM2" "Rcompression" "Rsolid" "fts" "nws"
## [6] "pbdRPC"
Note that the classification is not mutually exclusive (e.g. R-RCurl appears several times) and that there are RPMs that are not available from any standard R repository. These are listed under “Other”.
The cran2copr project maintains binary RPM repositories for the current and previous stable Fedora version for most of CRAN (more than 18k packages as of May 2022) in an automated way using Fedora Copr.
These repositories are automatically synchronized with CRAN every day at 00:00 UTC through a GitHub Action that removes archived packages and builds the most recent updates. To ensure compatibility with the official repositories, these set of packages are named “R-CRAN-pkgname” (instead of “R-pkgname”), and are installed into /usr/local/lib/R/library
.
To enable this Copr repository in your system:
$ sudo dnf install 'dnf-command(copr)'
$ sudo dnf copr enable iucar/cran
$ sudo dnf install R-CoprManager
The last command is optional, but recommended, because the CoprManager package integrates binary package installation into your R session. In this way, you can install or update packages in R as you normally do, e.g.,
install.packages("car")
update.packages(ask=FALSE)
in the R console, and packages will be automatically installed from the Copr repository. If a package is not available, then it just falls back to normal installation from CRAN.
On the other hand, remove.packages
will still remove only packages installed in your user library. If you want to remove system packages, run:
CoprManager::remove_copr("car")
If you want to disable the CoprManager, so that install.packages
only works with CRAN again, then run:
CoprManager::disable()
install.packages("car") # from CRAN to user lib
Since Fedora 33, R (as well as Numpy, Octave and all the other BLAS/LAPACK consumers) is linked against FlexiBLAS, a BLAS/LAPACK wrapper library that enables runtime switching of the optimized backend (see the change proposal for further details), and the OpenMP version of OpenBLAS is set as the default backend.
The accompanying flexiblas
R package enables BLAS/LAPACK switching without leaving the R session, as well as setting the number of threads for parallel backends (see the package’s README for further information).
$ sudo dnf install R-flexiblas # install FlexiBLAS API interface for R
$ sudo dnf install flexiblas-* # install all available optimized backends
Then, in an R session we see:
library(flexiblas)
# check whether FlexiBLAS is available
flexiblas_avail()
#> [1] TRUE
# get the current backend
flexiblas_current_backend()
#> [1] "OPENBLAS-OPENMP"
# list all available backends
flexiblas_list()
#> [1] "NETLIB" "__FALLBACK__" "BLIS-THREADS" "OPENBLAS-OPENMP"
#> [5] "BLIS-SERIAL" "ATLAS" "OPENBLAS-SERIAL" "OPENBLAS-THREADS"
#> [9] "BLIS-OPENMP"
# get/set the number of threads
flexiblas_set_num_threads(12)
flexiblas_get_num_threads()
#> [1] 12
This is an example of GEMM benchmark for all the backends available:
library(flexiblas)
n <- 2000
runs <- 10
ignore <- "__FALLBACK__"
A <- matrix(runif(n*n), nrow=n)
B <- matrix(runif(n*n), nrow=n)
# load backends
backends <- setdiff(flexiblas_list(), ignore)
idx <- flexiblas_load_backend(backends)
# benchmark
timings <- sapply(idx, function(i) {
flexiblas_switch(i)
# warm-up
C <- A[1:100, 1:100] %*% B[1:100, 1:100]
unname(system.time({
for (j in seq_len(runs))
C <- A %*% B
})[3])
})
results <- data.frame(
backend = backends,
`timing [s]` = timings,
`performance [GFlops]` = (2 * (n / 1000)^3) / timings,
check.names = FALSE)
results[order(results$performance),]
#> backend timing [s] performance [GFlops]
#> 1 NETLIB 56.776 0.2818092
#> 5 ATLAS 5.988 2.6720107
#> 2 BLIS-THREADS 3.442 4.6484602
#> 8 BLIS-OPENMP 3.408 4.6948357
#> 4 BLIS-SERIAL 3.395 4.7128130
#> 6 OPENBLAS-SERIAL 3.206 4.9906425
#> 7 OPENBLAS-THREADS 0.773 20.6985770
#> 3 OPENBLAS-OPENMP 0.761 21.0249671
The following add-ons are available in the official repositories:
Component | Description |
---|---|
rstudio-desktop | Integrated development environment for the R language |
rstudio-server | Access RStudio via a web browser |
rkward | Graphical front-end for the R language |
emacs-ess | Emacs Speaks Statistics under GNU Emacs |
There are official Fedora Docker images, maintained by the Fedora Release Engineering team, that can be used as base images for containerized R applications (for cloud deployments, CI/CD systems…). All the instructions above apply too for installation and maintenance of R software in these Docker images. However, you may see the following warning when installing R packages from source:
Warning in file.create(f.tg) :
cannot create file '/usr/share/doc/R/html/packages.html', reason 'No
such file or directory'
Warning in utils::make.packages.html(.Library, docdir = R.home("doc")) :
cannot update HTML package index
This is expected, because base Docker images add tsflags=nodocs
to /etc/dnf/dnf.conf
in order to minimize image sizes, and thus some documentation is missing in the R installation. However, this warning is completely harmless and can be safely ignored. If you still want to silence this warning, there are two options:
--setopt=tsflags=
will reset tsflags
and thus will install R’s docs.--no-docs
does not issue any warning.If you are using an old version of devtools
or remotes
to install R packages, the warning above may have turned into an error like the following:
Error in file.copy(file.path(R.home("doc"), "html", "R.css"), outman) :
(converted from warning) problem copying /usr/share/doc/R/html/R.css
to /usr/lib64/R/library/00LOCK-<package>/00new/<package>/html/R.css:
No such file or directory
This is a known issue that should be fixed in recent releases. Otherwise, setting the environment variable R_REMOTES_NO_ERRORS_FROM_WARNINGS=true
should avoid turning installation warnings to errors.
Toolbox enables a rootless containerized environment for everyday software development. It is best suited for immutable operating systems, such as Fedora Silverblue, but it can be used in any Fedora or CentOS/RedHat base system. It could be used as the main development environment to avoid installing anything in the base system, or e.g. to test a new R release only available in Fedora rawhide without polluting the main installation.
As an example, let us suppose that the base system runs R 4.0 on Fedora 34, and we want to test R 4.1, available in rawhide, before Fedora 35 is released:
$ sudo dnf install toolbox
$ toolbox enter --release 35
[toolbox]$ sudo dnf install R
[toolbox]$ R
R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu (64-bit)
Note that users do not need any administrative rights to install anything in their toolboxes. Once R is installed in the toolbox, it can be directly executed without entering first:
$ toolbox run --release 35 R
Your favorite IDE must be installed in the toolbox too in order to connect to the R installation there. GUIs such as RStudio Desktop should simply work:
[toolbox]$ sudo dnf install rstudio-desktop
[toolbox]$ rstudio
However, if you experience blank screens or interface glitches, a workaround is to use the Server version as follows:
[toolbox]$ sudo dnf install rstudio-server
[toolbox]$ sudo rserver --server-user=$(whoami) --verify-installation=1
[toolbox]$ rserver --server-user=$(whoami)
then, open any web browser and navigate to localhost:8787
.
See this introduction to Toolbox on Fedora as well as the documentation (man toolbox
) for further information.
Thanks to Martyn Plummer for maintaining a previous version of this page. The R stack for Fedora/EPEL is maintained by Tom “Spot” Callaway, Elliott Sales de Andrade, José Abílio Matos and Mattias Ellert among others. Additional CRAN RPMs for Fedora are maintained by Iñaki Ucar, built and distributed through Fedora Copr. The Copr Build System is maintained by Miroslav Suchý, Pavel Raiskup, Jakub Kadlcik and many others. Thanks to Martin Koehler and Fabio Valentini for their invaluable assistance in bringing FlexiBLAS to Fedora.