How can I install a R package on a offline Debian machine?

后端 未结 4 1813
逝去的感伤
逝去的感伤 2021-01-28 10:53

I have an Debian VM which is not connected to internet. Yet, I can still scp any file from my local machine which does have internet connection. To provide a little bit context,

相关标签:
4条回答
  • 2021-01-28 11:36

    To install some package-offline on Debian you can use apt-offline :

    apt-offline can fully update and upgrade an APT based distribution without connecting to the network, all of it transparent to APT.

    apt-offline can be used to generate a signature on a machine (with no network). This signature contains all download information required for the APT database system. This signature file can be used on another machine connected to the internet (which need not be a Debian box and can even be running windows) to download the updates. The downloaded data will contain all updates in a format understood by APT and this data can be used by apt-offline to update the non-networked machine.

    Install apt-offline on the offline os (Debian) then type the following command (to import missing keys) :

    sudo apt-key exportall | sudo gpg --no-default-keyring --import --keyring /etc/apt/trusted.gpg

    Then you need to get the signature of your_package_name:

    apt-offline set debian-install.sig --install-packages your_package_name
    

    Next step ,Upload debian-install.sig to the on-line system and download required files.

    apt-offline get debian-install.sig --bundle debian-install.zip 
    

    Upload debian-install.zip file to the off-line system, install it using apt-offline utility to update APT database.

    sudo apt-offline install debian-install.zip 
    

    install the specified packages your_package_name :

    sudo apt-get install your_package_name
    

    You can download your package using windows machine tuto

    0 讨论(0)
  • 2021-01-28 11:40

    sudo apt-get update

    sudo apt-get install r-cran-digest


    I can`t belive that it was so easy. I spent a long time searching and got only bad answers. This commands just solve everything. I used it on trisquel

    0 讨论(0)
  • 2021-01-28 11:42

    You are in a pickle. The R package mechanism expects you to be connected to get dependencies. That said, you can get some help:

    R> AP <- available.packages(contrib.url(options("repos")$repos[1]))
    R> revs <- tools::package_dependencies("shiny", AP, recursive=TRUE)[[1]]
    R> revs
     [1] "methods"   "utils"     "httpuv"    "mime"     
     [5] "jsonlite"  "xtable"    "digest"    "htmltools"
     [9] "R6"        "Rcpp"      "tools"     "stats"    
    R> 
    

    You can now look into AP again and feed this into download.packages().

    Also, several (all ?) of these are in a newer Debian distro so you could use apt-get in download-mode (maybe using apt-offline as suggested in the other question).

    Lastly, we do offer a Docker container for shiny so if you use that on your VM you don't need anything else.

    0 讨论(0)
  • 2021-01-28 11:57

    Shiny has a few package dependencies, and "R CMD INSTALL" won't find them for you, so you need to get them manually. According to the description of shiny, it's dependencies are: 'Rcpp’, ‘httpuv’, ‘mime’, ‘jsonlite’, ‘xtable’, ‘digest’, ‘htmltools’, ‘R6’. So first, get the packages from cran (below are current versions, but they do change over time. Note below is for the computer connected to the internet, you'll need to scp these to the offline computer before continuing):

    wget https://cran.r-project.org/src/contrib/Rcpp_0.12.4.tar.gz 
    wget https://cran.r-project.org/src/contrib/httpuv_1.3.3.tar.gz 
    wget https://cran.r-project.org/src/contrib/mime_0.4.tar.gz 
    wget https://cran.r-project.org/src/contrib/jsonlite_0.9.19.tar.gz 
    wget https://cran.r-project.org/src/contrib/digest_0.6.9.tar.gz 
    wget https://cran.r-project.org/src/contrib/htmltools_0.3.5.tar.gz 
    wget https://cran.r-project.org/src/contrib/R6_2.1.2.tar.gz 
    wget https://cran.r-project.org/src/contrib/shiny_0.13.2.tar.gz
    

    Then go through them in that same order with R CMD INSTALL. eg:

    R CMD INSTALL Rcpp_0.12.4.tar.gz
    

    Once all the dependencies are there, R CMD INSTALL should let you install shiny.

    0 讨论(0)
提交回复
热议问题