Chocolatey: Локальный репозиторий

В публичном (официальном репозитории) присутствуют ограничения на обращение к серверу, т.е. вы не сможете сразу на 20 машин раскидать нужное вам ПО. На локальном репозитории такие ограничения отсутствуют. Просто скачиваете или создаете сами нужный пакет, пушите его на свой сервер и устанавливаете его сколько вам угодно раз.

Требования:
  • .NET Framework 4.6+.
  • You need a Windows box with at least 50GB of free space (or where ever you are going to put the packages).
  • 50GB of free space for where ever you will put packages.
  • We recommend at least 8GB RAM, but more if you can.
  • Ability to set up an IIS site and unblock website ports.
  • If you have an IIS site for WSUS administration, see Configure Simple Server alongside WSUS admin-site for instructions on how to make Chocolatey Simple Server work alongside the WSUS admin-site.
  • If you can ensure your server is up to date with all of the Windows Updates, you will move through this process quite a bit quicker.

На всякий случай сначала ставим клиент chocolatey (powershell):

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Читать дальше

Chocolatey: Пример создания пакета .nupkg

На примере bareos-client.

Описание программы и общие сведения в файле bareos-client.nuspec:

<?xml version="1.0" encoding="utf-8"?>
<!-- Do not remove this test for UTF-8: if ??? doesn?t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
  <metadata>
	<!-- Read this before publishing packages to chocolatey.org: https://github.com/chocolatey/chocolatey/wiki/CreatePackages -->
	<id>bareos-client</id>
	<title>Winbareos</title>
	<version>19.2.7</version>
	<packageSourceUrl>https://github.com/sovamakarosh/chocolatey/tree/master/bareos-client</packageSourceUrl>
	<authors>Bareos GmbH and Co.KG</authors>
	<owners>Slava Makarov</owners>
	<summary>Backup</summary>
	<description>Bareos is a 100% open source fork of the backup project from bacula.org. 
	The fork is in development since late 2010, it has a lot of new features. 
	The source has been published on github, licensed AGPLv3.</description>
	<projectUrl>https://www.bareos.org/en/</projectUrl>
	<projectSourceUrl>https://www.bareos.org/en/open-source.html</projectSourceUrl>
	<docsUrl>https://www.bareos.org/en/documentation.html</docsUrl>
	<mailingListUrl>https://www.bareos.org/en/howto-contribute.html#mailinglists</mailingListUrl>
	<bugTrackerUrl>https://bugs.bareos.org/my_view_page.php</bugTrackerUrl>
	<tags>bareos winbareos admin backup windows</tags>
	<copyright>© Copyright Bareos GmbH and Co. KG. Bareos is a registered Trademark of Bareos GmbH and Co. KG.</copyright>
	<licenseUrl>https://docs.bareos.org/Appendix/BareosCopyrightTrademarkAndLicenses.html</licenseUrl>
	<requireLicenseAcceptance>false</requireLicenseAcceptance>
	<!-- Important note about https://cdn.rawgit.com: Files are cached permanently after the first request. Use commit URLs when updating the icon. -->
	<iconUrl>https://raw.github.com/C-Duv/chocolatey-winbareos/master/winbareos/winbareos-logo.png</iconUrl>
	<!--<dependencies>
	  <dependency id="" version="" />
	</dependencies>-->
	<releaseNotes>32bit, 64bit.</releaseNotes>
  </metadata>
  <files>
	<file src="tools\**" target="tools" />
  </files>
</package>
Описание процесса установки chocolateyInstall.ps1:

$packageName = 'bareos-client'
$installerType = 'exe'
$url = 'https://download.bareos.org/bareos/release/19.2/windows/winbareos-19.2.7-release-32-bit.exe'
$url64 = 'https://download.bareos.org/bareos/release/19.2/windows/winbareos-19.2.7-release-64-bit.exe'
$silentArgs = '/S'
$validExitCodes = @(0)
$checksum      = '3CA9FE7BC67DC042F9F97AB448F05A733502833BFCADE3B26CCEF900545E7FAF'
$checksumType  = 'sha256'
$checksum64    = 'D2880A6110C7A1A42AED7BB97F0BCB176F58427223EFF1C305A183382CFC1055'
$checksumType64= 'sha256'

Install-ChocolateyPackage "$packageName" "$installerType" "$silentArgs" "$url" "$url64" "$checksum" "$checksumType" "$checksum64" "$checksumType64"  -validExitCodes $validExitCodes
Если надо получить md5 хеш (PowerShell):
Get-FileHash -Path '.\winbareos.msi' -Algorithm SHA256
Пакуем в .nupkg:
cpack -y
Пробная установка из локального пакета:
cinst -fvy .\bareos-client.19.2.7.nupkg
Если всё ок, пушим в репозиторий:
choco push .\bareos-client.19.2.7.nupkg --source https://push.chocolatey.org/