I wrote about this before, but since this is a frequent problem and my last post wasn’t brief, here’s a shorter version.
The primary way to install software in Linux is to rely on
apt in Mint) or some other package manager. The way this works is that there is a central server which holds a list of all the software available for that version of Linux you installed. The problem is that your installed version of Linux is based on an older list of this software and thus when you try to update, it says there isn’t any newer version available when there actually is.
To solve this, you have to add more lists of software so Linux knows where to look for the newer versions of the software. For R, there’s a list of mirrors here and all you have to do is edit the
/etc/apt/sources.list file to include something like this:
deb http://cloud.r-project.org/bin/linux/ubuntu xenial/
The name at the end corresponds to your Ubuntu version. You can look here to find which name to use. It’s always the first word in the name. The first part is one of the CRAN mirrors of which there is a list.
After this you update the list of software by:
This may work, or it may not (bug fixing in Linux is inherently stochastic). If you get an error like this:
W: GPG error: http://cloud.r-project.org/bin/linux/ubuntu xenial/ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9 E: The repository 'http://cloud.r-project.org/bin/linux/ubuntu xenial/ 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.
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys51716619E084DAB9
Notice the number as the end. You must copy the one from the error message. When you run the above, you should get something like:
Executing: /tmp/tmp.nyQRPoVeus/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 51716619E084DAB9 gpg: requesting key E084DAB9 from hkp server keyserver.ubuntu.com gpg: key E084DAB9: public key "Michael Rutter <firstname.lastname@example.org>" imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1)
If so, then you’re good to go. Then you update the list of software and update R:
apt-get update apt-get install r-base r-base-dev