how to Update R in RStudio server

Hi,

I was wondering how I can update R on Rstudio server, as I don't have the latest version of R.

I do recall having some error messages when installing R, which may be the cause.

If I run sudo apt- get update, I get the following message:

Hit:1 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu focal InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://security.ubuntu.com/ubuntu focal-security InRelease [109 kB]
Get:5 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ InRelease [3622 B]
Get:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Err:5 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9
Reading package lists... Done
W: GPG error: https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9
E: The repository 'https://cloud.r-project.org/bin/linux/ubuntu focal-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.

Any thoughts?
Ellen

In general we recommend you don't use apt install to update R, but to install multiple versions of R side-by-side, using the instructions at RStudio Install R - RStudio Documentation

The reason for this recommendation is that once you update R, some of your older scripts could potentially break. So it's generally better to let your users choose which version of R to use.

That said, you can also follow the instruction from CRAN directly, if you prefer: Ubuntu Packages For R - Brief Instructions, specifically this part:

# update indices
apt update -qq
# install two helper packages we need
apt install --no-install-recommends software-properties-common dirmngr
# import the signing key (by Michael Rutter) for these repo
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
# add the R 4.0 repo from CRAN -- adjust 'focal' to 'groovy' or 'bionic' as needed
add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"

Hi Andrie,
Thanks for your quick response! seems indeed I forgot to import the signing key.

best wishes and have a nice weekend,
Ellen

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.