Search code examples
artifactorychocolatey

Mirror Chocolatey with Artifactory


JFrog Artifactory supports NuGet sources. How would you configure Chocolatey to point to an Artifactory server instead of chocolatey.org?


Solution

  • Create a 'remote' repository that points to Chocolatey's NuGet API:

    Enter image description here

    Then in Chocolatey, configure an alternative source:

    choco source list
    choco source Add -Name artifactory -Source https://artifactory.example.com/artifactory/api/nuget/chocolatey
    choco source enable --name artifactory
    choco source disable --name chocolatey
    

    You can leave both sources enabled and Chocolatey will fall back to secondary sources, or you can force all package downloads to come from Artifactory.

    Most Chocolatey packages don't bundle the .msi installer inside them; instead the Chocolatey package contains scripts to fetch installers from elsewhere. This solution will only mitigate issues if chocolatey.org becomes unavailable (e.g choco install splunk-universalforwarder will continue to work even if 'chocolatey.org' is offline, but not if 'splunk.com/downloads' is offline).