Establishing a Chocolatey Environment (Windows Server 2016)

Chocolatey is a variation of NuGet server that is freely available in different forms.  NuGet is targeted as a class or library distribution system that allows developers to search for (and install) modules into developed projects.  The variation of Chocolatey allows packages to also run install and uninstall scripts – which transforms the NuGet framework into a fully-fledged package management system. 

Windows Management Framework 5.1 incorporates Chocolatey providers that allow packages to be installed to a Windows system with single-line PowerShell commands.

Installing the Chocolatey Server

Microsoft have made available a Visual Studio project for compiling a basic NuGet server.  A pre-compiled distribution is Klondike that may be mounted as a website without the requirement of Visual Studio.  The current Chocolatey release may be downloaded directly from GitHub.

https://github.com/themotleyfool/Klondike/releases

I’m intending to use Chocolatey on a Windows Server 2016, Azure marketplaace image.  After downloading the latesst Klondike build, I’ve extracted the  files and copied the Klondike directory to the inetpub root folder on my server.

I’ll need to ensure that the IIS user account has rights to the files.  I’ll do this by right-clicking on the new folder, going to properties and then the Security tab.  I can now edit the permissions.

 

I’ll select the default IIS-IUSRS account.

The user account will require modify, read & execute,  list folder contents and read permissions to the selected directory.

By default, Server 2016 doesn’t have IIS Manager installed.  I’ll install this quickly with PowerShell.

… and then start the IIS manager application.

I’m going to add a new website for Klondike.  You might however prefer to use the Default Website.

For testing, I’m going to bind my site to unencrypted http – at some stage later I’d change this to use a certificate.

Because I decided to replace the Default Web Site I’m going to have to stop the original site and start my new one.

 

As Klondike is now running, I can view it through the web browser.

Testing Package Deployment

I’m going to upload a couple of basic NuGet / Chocolatey packages to the server.  These are very simple packages that you can pull apart and look at.

AddFeatureTelnetClient_01.00_86a.1.0.0.nupkg

AddFeatureSNMPService_01.00_86a.1.0.0.nupkg

You might like to look at how to create Chocolatey packages if you havent done so already.

Once the packages are uploaded, I’ll refresh the package index through the Admin section of the web console.

The packages section of the console now lists my packages as deployable.


Using PowerShell / Windows Management 5.1 – I can now use the Chocolatey Repo to deploy the packages.