How to install R on Ubuntu 16.04


R is an open source programming language which is used for statistical computing and graphics. The R programming language is widely used by statisticians and data miners mostly for data analysis or developing statistical software. In this tutorial, we will help you to install R on a Linux VPS running Ubuntu as an operating system.

The first thing you need to do is to connect to your server via SSH and update all your system software to the latest version available. For that purpose you can run the following command:

# apt-get update && apt-get -y upgrade

The upgrade process will take from a few seconds to a few minutes depending on the packages that need to be upgraded. Once the upgrade process is completed you can continue with the other steps of this tutorial.

The next thing you need to do is to add R to Ubuntu keyring by using the commands bellow:

# gpg --keyserver --recv-key E084DAB9
# gpg -a --export E084DAB9 | sudo apt-key add -

Then, you can go ahead an add the R repository to the /etc/apt/sources.list file.

# echo "deb xenial/" | tee -a /etc/apt/sources.list

Please note that ‘xenial’ is included in the line which means we will install R on an Ubuntu 16.04 VPS. If you run a different version of Ubuntu, you will need to use the appropriate version.

Now it is time to install R on your machine. First, update the package list by using the following command:

# apt-get update

Then install the R language by using the following command:

# apt-get install r-base r-base-dev

The installation could a take few minutes depending on your connection speed. Once the installation is completed you can start with writing code in R.

To start R, you can enter the command below:

# R

If everything is OK, you should see something like the following:

# R

R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.


The first line shows the version of R installed on your Ubuntu VPS. At the moment of writing this tutorial, it is 3.3.1.

You can read the manuals at for more information about how to get started with using the programming language.

Of course you don’t have to do any of this if you use one of our Linux VPS hosting services, in which case you can simply ask our expert Linux admins to help you install R on your server. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Install PowerDNS and PowerAdmin on an Ubuntu 14.04 VPS
How to install e107 CMS on Ubuntu 14.04
Install Pligg CMS on CentOS 6
There are currently no comments.