How do I install Chocolatey packages entirely from "local" resources?

javapadawan picture javapadawan · Feb 3, 2016 · Viewed 10.5k times · Source

I am trying to install a Chocolatey package from local. Since I want to be able to store all the "artifacts" in a disk and go to a PC and just type

choco install <pkgname> -s D:\External\choco-repo

I noticed that the

choco search <pkgname> -s D:\External\choco-repo

works, however when I install it, it still pulls the artifacts from the HTTP feed. Is there a way to just use local storage or a network drive to perform installations?

Note that what I did was copy the contents of C:\ProgramData\chocolatey\lib to D:\External\choco-repo.

Answer

Gary Ewan Park picture Gary Ewan Park · Feb 3, 2016

Almost all Chocolatey packages are simply a wrapper around what you "would do" if you were to do the installation manually. This includes downloading the required files from the Internet.

If you look at the contents of the Chocolatey package, you will see the required URLs to download the EXE, MSI, and ZIP files required to do the install. The application installers are typically NOT contained within the Chocolatey package. This is due to distribution limitations.

Having said that, Chocolatey does download the required files to a known location on the hard drive, and as of the time of writing, if an installation of the same package is attempted, the cached downloaded version of the installer will be used, however, this technique is not guaranteed, or supported.

Instead, the best bet, in terms of your own maintainability, would be to modify the Chocolatey packages that you want to use, and instruct them to use the installer which you host internally, somewhere.

Going forward, the offline installation story with Chocolatey is planned to get better, but right now, there is still some manual work that you have to do.