I have R 2.12.1 installed in my ubuntu, and I'd like upgrade to lastest version 2.15, how can achieve that ? Thanks
-
this is probably relevant: superuser.com/questions/279088/…– ChaseMay 7, 2012 at 4:44
-
2The R guide for this is here: cran.r-project.org/bin/linux/ubuntu/README.html– Adam EricksonApr 19, 2015 at 2:56
-
1Shouldn't this question have been moved to askubuntu.com instead of closing it down?– Janaka BandaraMay 27, 2015 at 12:47
-
Easy steps here : digitalocean.com/community/tutorials/…– Digvijay SawantMay 15, 2018 at 16:40
-
Updating Adam Erickson's link: cran.r-project.org/bin/linux/ubuntu/fullREADME.html instructions are for R >= 4.1– chinsoon12Jan 6, 2022 at 0:31
1 Answer
Since R is already installed, you should be able to upgrade it with this method. First of all, you may want to have the packages you installed in the previous version in the new one,so it is convenient to check this post. Then, follow the instructions from here
Open the
sources.list
file:sudo nano /etc/apt/sources.list
Add a line with the source from where the packages will be retrieved. For example:
deb https://cloud.r-project.org/bin/linux/ubuntu/ version/
Replace
https://cloud.r-project.org
with whatever mirror you would like to use, and replaceversion/
with whatever version of Ubuntu you are using (eg,trusty/
,xenial/
, and so on). If you're getting a "Malformed line error", check to see if you have a space between/ubuntu/
andversion/
.Fetch the secure APT key:
gpg --keyserver keyserver.ubuntu.com --recv-key E298A3A825C0D65DFD57CBB651716619E084DAB9
or
gpg --hkp://keyserver keyserver.ubuntu.com:80 --recv-key E298A3A825C0D65DFD57CBB651716619E084DAB9
Add it to keyring:
gpg -a --export E084DAB9 | sudo apt-key add -
Update your sources and upgrade your installation:
sudo apt-get update && sudo apt-get upgrade
Install the new version
sudo apt-get install r-base-dev
Recover your old packages following the solution that best suits to you (see this). For instance, to recover all the packages (not only those from CRAN) the idea is:
-- copy the packages from R-oldversion/library
to R-newversion/library
, (do not overwrite a package if it already exists in the new version!).
-- Run the R command update.packages(checkBuilt=TRUE, ask=FALSE)
.
-
2Hello Ananda and others, I would love to include some of these solutions into the installr package: github.com/talgalili/installr Are any of you willing to pitch it? Mar 12, 2013 at 11:13
-
1
-
1Note that this method will upgrade many other things besides R, which may not be what you want to do.– AsuJun 13, 2017 at 11:42
-
1Hi, just to follow up on that answer. For me, seems that the website from step 2 is down. I used another one : cran.rstudio.com/bin/linux/ubuntu. The line that I added into the source.list file is : deb cran.rstudio.com/bin/linux/ubuntu bionic-cran35/ Jun 26, 2019 at 18:04
-
1Using the short ID for the key downloaded the spoofed key for me ("Totally Legit Signing Key"). See dev.gnupg.org/T4136 for details and update your answer with full key ID.– Fato39Feb 9, 2021 at 13:03