How to Update R on Debian 10 / buster?

I successfully installed R and RStudio on this machine which is running Debian GNU/Linux 10 (buster). It installed r version 3.5.2 which seems built in. I've Googled and tried various remedies to update to a more recent version of R (I was able to update RStudio). How do I update R itself on this machine? Linux is a foreign language to me so I can enter commands at the terminal but have little comprehension. FWIW below are links to some of the things I have tried:
https://github.com/duckmayr/install-update-r-on-linux
https://stackoverflow.com/questions/46214061/how-to-upgrade-r-in-linux

You can find the official installation instructions for Debian here

https://cran.r-project.org/bin/linux/debian

I got this recipe from some guy @andresrcs () and it's what I use.

sudo apt-get upgrade -y gfortran libreadline6-dev libx11-dev libxt-dev \
                               libpng-dev libjpeg-dev libcairo2-dev xvfb \
                               libbz2-dev libzstd-dev liblzma-dev \
                               libcurl4-openssl-dev \
                               texinfo texlive texlive-fonts-extra \
                               screen wget libpcre2-dev
cd /usr/local/src
sudo wget https://cran.r-project.org/src/base/R-4/R-4.1.0.tar.gz
sudo tar zxvf R-4.1.0.tar.gz
cd R-4.1.0 # current version
sudo ./configure --enable-R-shlib #--with-blas --with-lapack #optional
sudo make
sudo make install
cd ..
sudo rm -rf R-4.0.4* # your current version
exit
cd
1 Like

Thanks @technocrat. Worked like a charm.

Have in mind that since you have compiled R yourself instead of adding a source repository (like in the official instructions) you are not going to get R updates, if you want to update in the future you would need to manually compile again.

1 Like

Thanks. That's a great resource. At this stage I am trying to update R. I suppose the next stage will be to update packages. When I follow the instructions, I update the/etc/apt/sources.list file to include the last line shown below (letting you see entire file)

deb https://deb.debian.org/debian buster main
deb https://security.debian.org/debian-security buster/updates main
deb https://cloud.r-project.org/bin/linux/debian buster-cran40/ 

Then I apply the command line

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

The first line produces:

xer0925@penguin:~$ sudo apt-get update
Hit:1 https://deb.debian.org/debian buster InRelease
Ign:2 https://storage.googleapis.com/cros-packages/96 buster InRelease                    
Get:3 https://cloud.r-project.org/bin/linux/debian buster-cran40/ InRelease [4,363 B]     
Ign:4 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu jammy InRelease
Hit:5 https://storage.googleapis.com/cros-packages/96 buster Release
Hit:6 https://security.debian.org/debian-security buster/updates InRelease
Err:7 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu jammy Release
  404  Not Found [IP: 91.189.95.85 80]
Err:3 https://cloud.r-project.org/bin/linux/debian buster-cran40/ InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B8F25A8A73EACF41
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu jammy Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: https://cloud.r-project.org/bin/linux/debian buster-cran40/ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B8F25A8A73EACF41
E: The repository 'https://cloud.r-project.org/bin/linux/debian buster-cran40/ InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: Target Packages (Packages) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list.d/r.list:1
W: Target Translations (en_US) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list.d/r.list:1
W: Target Translations (en) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list.d/r.list:1

Still I try the second command and get:

xer0925@penguin:~$ sudo apt-get install r-base r-base-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
r-base is already the newest version (3.5.2-1).
r-base-dev is already the newest version (3.5.2-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

And to make sure it didn't update:

xer0925@penguin:~$ R --version
R version 3.5.2 (2018-12-20) -- "Eggshell Igloo"
Copyright (C) 2018 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
http://www.gnu.org/licenses/.

Any suggestions as to what I should try next? Thanks.

You have forgot to add the apt key

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key '95C0FAF38DB3CCAD0C080A7BDC78B2DDEABC47B7'
1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.