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, I am trying to host an shiny app on the VM.
I can still install an old version of R 3.1.1 with the "apt-get" command:
sudo apt-get update
sudo apt-get install r-base
sudo apt-get install r-base-dev
Yet, still can't find the "shiny" package when check the list:
sudo apt-cache search "^r-.*" | sort
So, I am thinking whether I could just scp the "shiny.tar.gz" to the VM and install the package locally? How could I install any R package offline?
I have tried somethings like:
install.packages('/home/mli/R/dir_pkg/shiny/shiny_0.13.2.tar.gz', repos = NULL, type = "source")
Yet, it didn't go through and error message as below:
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Error in type == "both" :
comparison (1) is possible only for atomic and list types
Calls: install.packages
Execution halted
Then, I tried it with another "R CMD":
R CMD INSTALL /home/mli/R/dir_pkg/shiny/shiny_0.13.2.tar.gz
I got error message telling me that dependencies is missing:
* installing to library ‘/home/mli/R/x86_64-pc-linux-gnu-library/3.1’
ERROR: dependencies ‘httpuv’, ‘mime’, ‘jsonlite’, ‘xtable’, ‘digest’, ‘htmltools’, ‘R6’ are not available for package ‘shiny’
* removing ‘/home/mli/R/x86_64-pc-linux-gnu-library/3.1/shiny’
How can I successfully install shiny package from source? Should I go ahead to install all dependencies and dependencies of dependencies first?
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):
Then go through them in that same order with R CMD INSTALL. eg:
Once all the dependencies are there, R CMD INSTALL should let you install shiny.
You are in a pickle. The R package mechanism expects you to be connected to get dependencies. That said, you can get some help:
You can now look into
AP
again and feed this intodownload.packages()
.Also, several (all ?) of these are in a newer Debian distro so you could use
apt-get
in download-mode (maybe usingapt-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.
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
To install some package-offline on Debian you can use apt-offline :
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
:Next step ,Upload
debian-install.sig
to the on-line system and download required files.Upload debian-install.zip file to the off-line system, install it using apt-offline utility to update APT database.
install the specified packages
your_package_name
:You can download your package using windows machine tuto