简体   繁体   中英

Upgrade R in Ubuntu xenial

I am trying to update R in my Ubuntu Xenial machine. When I run:

R --version 

the output is

R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"

I have been checking a lot of post about how to do it. My main steps have been:

Open the source list and add the link

sudo nano /etc/apt/sources.list
deb http://cran.rstudio.com/bin/linux/ubuntu xenial/

(Maybe I am adding the link in the wrong place of the source.list? I don't know, I am new in Ubuntu). After adding the link, I save and exit the source.list. Then my steps have been:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install r-base

Once the process is finished, I run again:

R --version

And the output is still

R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"

I don't have a lot of experience with Linux yet but based on previous post and their solutions I cannot manage to solve the problem.

By the way, I need to update R since some of the packages I need to use (such as rgdal) are not available under the version I currently have

Thanks for the help

M

See this , as you are already doing you have to use the distribution from CRAN:

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

sudo add-apt-repository 'deb [arch=amd64,i386] https://cran.rstudio.com/bin/linux/ubuntu xenial/'

sudo apt-get update

sudo apt-get install r-base

The CRAN README probably is the right place to read first.

What you have it pretty good. I would make it

a) use a file, say cran.list inside of /etc/apt/sources.list.d/

b) use https:// , ie I have deb https://cloud.r-project.org/bin/linux/ubuntu zesty/ (and that actually points to the same CDN servers as what you have)

c) run apt-get update and then check via apt-cache policy r-base-core

It should show both the newer (at CRAN) and older (from Ubuntu):

edd@bud:~$ apt-cache policy r-base-core
r-base-core:
  Installed: 3.4.3-1zesty0
  Candidate: 3.4.3-1zesty0
  Version table:
 *** 3.4.3-1zesty0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu zesty/ Packages
        100 /var/lib/dpkg/status
     3.4.2-2zesty 500
        500 https://cloud.r-project.org/bin/linux/ubuntu zesty/ Packages
     3.4.2-1zesty1 500
        500 https://cloud.r-project.org/bin/linux/ubuntu zesty/ Packages
     3.4.1-2zesty0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu zesty/ Packages
     3.4.1-1zesty0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu zesty/ Packages
     3.4.0-1zesty 500
        500 https://cloud.r-project.org/bin/linux/ubuntu zesty/ Packages
     3.3.2-1 500
        500 http://us.archive.ubuntu.com/ubuntu zesty/universe amd64 Packages
edd@bud:~$

The three stars show that that is the installed version.

d) Now when you see the desired version available, install the usual way via apt-get install r-base-core . You should get the highest version as expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM