How to install R-base 4.0.1 successfully

RolfMeles
  1 year ago
  0

Hey all, 

it took over 5 hours for me to find out, how to install the latest version of R AND be able to install all packages.

Here is how I have done it:

 

First you have to add the key and repository for the latest version. This is done with the following terminal commands:

This adds the gpg key:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

 

This adds a new repository for R as well as for all packages you will install later on:

sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/'

 

To be sure all of it is found you need to run

sudo apt-get update

 

Now you can install r-base. But make sure to also install r-base-dev because otherwise it won't install all of the packages you are probably going to install later on:

sudo apt-get install r-base r-base-dev

 

As with most installations you will probably have to confirm the installation.

When it is done you can type in

R --version

Which should result in an output like this:

R version 4.0.1 (2020-06-06) -- "See Things Now"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-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/.

 

You might think this was all.

But NO.

You will probably need to manually install the following software too, as it is needed for some R packages:

sudo apt-get install gfortran
sudo apt-get install xorg-dev
sudo apt-get install libx11-dev
sudo apt-get install mesa-common-dev
apt-get install libglu1-mesa-dev

Only after all of these installations was I able to install all packages I needed so far. I installed way more packages but they did not help so I hope the ones listed above are really enough. If not please comment if you found other software needed for a smooth R run! 

Have fun!

Comments
CaroZ 7 months ago

Hello,
I could really use your help :)
I am running Linux 19.1, and I am not managing to install R 4.0 at all.
I have followed instructions from here
https://cloud.r-project.org/bin/linux/ubuntu/
and many other places, and I even asked my question here
https://stackoverflow.com/questions/67196504/unable-to-install-r-4-0-on-linux-mint-19-1-tessa?noredirect=1#comment118775787_67196504

I also followed your instructions, but nothing does it. In the end, I end up reinstalling the older version of R.
I manually changed
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'
to
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/'

but nothing does it.

I don't know what to do anymore !

Thanks !