How do I install Chocolatey packages offline?

后端 未结 7 1586
误落风尘
误落风尘 2021-02-01 17:54

I am trying to automate to set up a developer machine software installation. Chocolatey is good to install packages when you connected to the Internet. Is there a way to install

7条回答
  •  余生分开走
    2021-02-01 18:47

    So, I have created a Nullsoft installer that needed to install Chocolatey packages from an offline computer. These are the overall steps:

    1. Download the Chocolatey packages to a temporary directory with:

      NuGet.exe Install some_package_name -OutputDirectory C:\Temp\ChocoPackages -ExcludeVersion
      
    2. In the Nullsoft script, add these lines to pick up the download packages:

      nsExec::Exec 'choco feature disable -n=allowGlobalConfirmation'
      

      SetOutPath "${TmpPath}ChocoPackages" File /r "C:\Temp\ChocoPackages*.*"

    3. While still in the Nullsoft script, use this command to install a Chocolatey package from the temporary directory that the files were placed at during the install process:

      choco install --Source "${TmpPath}ChocoPackages" ${Name_Of_ChocoPackage} --acceptlicense --yes
      

提交回复
热议问题