Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# Install R + RStudio on Ubuntu 16.04
sudo apt-key adv –keyserver –recv-keys E084DAB9
# Ubuntu 12.04: precise
# Ubuntu 14.04: trusty
# Ubuntu 16.04: xenial
# Basic format of next line deb https://<my.favorite.cran.mirror>/bin/linux/ubuntu <enter your ubuntu version>/
sudo add-apt-repository 'deb xenial/'
sudo apt-get update
sudo apt-get install r-base
sudo apt-get install r-base-dev
# Download and Install RStudio
sudo apt-get install gdebi-core
sudo gdebi rstudio-1.0.44-amd64.deb
rm rstudio-1.0.44-amd64.deb
Copy link

ThiagoCM commented May 15, 2017


Copy link

dataviz93 commented Aug 10, 2017

Thanks for this, it's perfect!

Copy link

trufflemedia commented Sep 15, 2017


the line

sudo apt-key adv –keyserver –recv-keys E084DAB9

should be

sudo apt-key adv ––keyserver ––recv-keys E084DAB9

Something changed the two “en dash” (the minus sign to us normal people) in front of keyserver and recvkey into an “em dash” (the longer dash).

Copy link

dlainfiesta commented Oct 5, 2017

Perfect man...thanks a lot!

Copy link

filibtester commented Oct 16, 2017


which RStudio tutorial do you recommend??



Copy link

Hemantime commented Nov 9, 2017


Copy link

gitdungeon commented Nov 21, 2017

I am new to this so....

Does anyone know what this command is for ??

" sudo apt-key adv –keyserver –recv-keys E084DAB9 "

Copy link

t-student commented Feb 28, 2018

Copy link

DiliSR commented Mar 8, 2018

Thank you. Perfect answer :)

Copy link

rafaelvareto commented Mar 20, 2018

Tried other installation methods and did not work.

Copy link

spriyak02 commented Mar 22, 2018

This was really helpful for someone new to Ubuntu, thank you!

Copy link

felexkemboi commented Mar 24, 2018

Thank helpfull

Copy link

raquellu commented Mar 27, 2018

No se que podría hacer para solucionar esto que me dice, como puedo instalar este paquete que falta?

sudo gdebi rstudio-1.0.44-amd64.deb
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading state information... Done
No se puede instalar este paquete
Dependency is not satisfiable: libgstreamer0.10-0

Copy link

hansharhoff commented Apr 13, 2018

@raquellu, you probably have to enable the universe packages of Ubuntu. Go to Software and Updates and on the first tab enable the "Community-maintained free and open-source software (universe)" checkbox. Then try again.

Copy link

vahid-dan commented Apr 21, 2018

This dependency was also required on my machine:

sudo apt-get install libjpeg62

Copy link

fhasouza85 commented Apr 28, 2018

For me continues to install R 3.4.4 :(
I want the newest version 3.5.0

Copy link

Enkeleda commented Apr 29, 2018

Thanks, very useful 👍

Copy link

klpthbst commented May 21, 2018

thanks a lot

Copy link

sonali7575 commented Jun 1, 2018

Thank you! It is very useful.

Copy link

PalomaresScorp28 commented Aug 9, 2018

Thanks bro, pretty useful

Copy link

zer0mode commented Oct 4, 2018


For me continues to install R 3.4.4 :(
I want the newest version 3.5.0

You need to add it in your repositories list. That should work :
$ sudo sh -c "cat > /etc/apt/sources.list.d/r.list"

deb xenial-cran35/

  • update
    $ sudo apt-get update
  • sign the keys
    $ sudo apt-key adv --keyserver --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
  • install
    $ sudo apt-get install r-base

Don't forget to uninstall the current version first !

Copy link

D-RakeshParija commented Nov 28, 2018

I have followed the same step for the newest version 3.5.1. The R version upgraded, but all the R commands not working like
It shows canclled

Copy link

agn-7 commented Jun 29, 2019

I had a problem with sudo gdebi rstudio-1.0.44-amd64.deb so I used commands bellow instead:

sudo dpkg -i rstudio-1.0.44-amd64.deb
sudo apt-get install -f

Copy link

agilebean commented Aug 22, 2019

Hey, I had the same problems upgrading to the newest R-version.
First, remove all your r installation if it doesn't work by
sudo apt purge r-base* r-recommended r-cran-*

The only way to get R 3.5/3.6 installed correctly was the following way:

sudo add-apt-repository ppa:marutter/rrutter3.5
sudo apt-get update
sudo apt-get -y install r-api-3.5

Copy link

mmdoka commented Jan 17, 2020

sudo su
echo "deb xenial-cran35/" >> /etc/apt/sources.list
apt-key adv --keyserver --recv-keys E084DAB9
apt-get update
apt-get install r-base
apt-get install r-base-dev

Copy link

susajsnair commented Apr 5, 2020

i am having issues

when try to open after the installation, showing a blank rstudio application

Copy link

miguelvaara commented Apr 9, 2020

Great! Thank a lot! :-). Works nicely

Copy link

mridulgain commented Apr 27, 2020

Thanks !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment