简体   繁体   中英

How to install R from tar gz file

I have R in 3.6.3 version and I want to download 4.0.0 version. I downloaded from https://cran.r-project.org/src/base/R-4/ tar gz file but I have no idea how can I install it. Could you please give me a command which can install this R version from tar gz file?

Install R from Source on Linux

You can find a detailed description for a range of different Linux systems here .

In short, you will need to run the following chain of commands:

First to install dependencies. This will depend on your Linux distribution. For Linux Mint, you can do

sudo apt-get build-dep r-base

Then, specify your desired R version

export R_VERSION=4.2.1

In a folder of your choice, download the.tar.gz (For versions other than 4.X, you may need to adjust the link)

curl -O https://cran.rstudio.com/src/base/R-4/R-${R_VERSION}.tar.gz
tar -xzvf R-${R_VERSION}.tar.gz
cd R-${R_VERSION}

To build and install, run from the same shell

./configure \
    --prefix=/opt/R/${R_VERSION} \
    --enable-memory-profiling \
    --enable-R-shlib \
    --with-blas \
    --with-lapack

make
sudo make install

In case the ./configure... step does not work out, you may need to install the missing binaries individually by hand.

You can check the installation by running

/opt/R/${R_VERSION}/bin/R --version

and create a symlink

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

Done!

Your R installation will be in

/opt/R/${R_VERSION}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM