Search code examples
rlinuxdebiancran

Install the latest R version on a offline Debian machine


I have an offline Debian VM on which I would like to install the version of R - 3.2.3. Yet, since the VM can't be directly connected to outside internet, I can only scp source file to it from my local which has internet access.

First, I have tried default "apt-get install..." to install r-base and r-base-dev from local repo on the Debian VM:

$ sudo apt-get install r-base r-base-dev

Yet, I can only get r version 3.1.1 from repo. So, I followed an solution from this post: https://unix.stackexchange.com/questions/153194/installing-latest-r-base-from-r-project

I added "deb http://cran.rstudio.com/bin/linux/debian wheezy-cran3/" to the "/etc/apt/sources.list" file. Yet, since the VM can't connect to internet, the system timed out when I ran the following commands as the instruction:

gpg --keyserver pgpkeys.mit.edu --recv-key 06F90DE5381BA480

gpg -a --export 06F90DE5381BA480 |sudo apt-key add -

However, as a test, I still go ahead to reinstall r-base & r-base-dev:

$ sudo apt-get --purge remove r-base r-base-dev
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install r-base r-base-dev

I somehow did get the latest r version installed on my VM:

R version 3.2.5 (2016-04-14) -- "Very, Very Secure Dishes"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

Yet, i have also had error message when installing r:

WARNING: The following packages cannot be authenticated!
r-base-core r-recommended r-base r-base-dev

I am sure that I didn't do it right.. Yet, would like any help on how to correctly install latest r version on my offline Debian VM. Thanks guys!


Solution

  • Run the following commands on your local machine(with internet access):

    1. Download the required packages: apt-get download r-base r-base-dev r-requirements
    2. The above command will download the .deb packages for you in the current directory.
    3. Copy(scp) the r-base_3.2.3-4_all.deb, r-base-dev_3.2.3-4_all.deb and r-recommended_3.2.3-4_all.deb to your Debian VM.
    4. Now you can install the packages using the following command: sudo dpkg -i r-base_3.2.3-4_all.deb r-base_3.2.3-4_all.deb r-recommended_3.2.3-4_all.deb.

    Note: Keep an eye on the package versions. Also, if dpkg -i command is asking for any other requirements, you would need to download those as well and pass all the downloaded .deb packages to the dpkg -i command.