What does DevOps have to do with Windows package management?
Good question, since maintaining consistency with software tools is a key principle in Development Operations. You don’t always have a choice on what environment or platform you can run and you are stuck with maintaining a Windows environment. Windows has been a pain for myself and many other people taking care of Window machines because the business needs them. Besides the most common problems in maintaining a Windows machine, installation and management of software is a big pain. It’s very likely that you have to support Windows in a desktop environment and server environment. I always thought, being an old school Unix Sys Admin, “Why can’t we have an automated package manager like apt-get, pkgadd, which are available in Unix/Linux in Windows?”
The answer I and many others found is in Chocolatey.
What is Chocolatey?
Chocolatey is a nuget based Windows package manager. Nuget is a .net framework library manager developed by Microsoft. The mechanisms used in Nuget is used for installing Windows packages.
Chocolatey does the following:
1 – Install software
2 – Upgrades software
3 – Remove software
4 – Installs dependencies
5 – Support unattended installs
6 – Support private repositories
7 – Works with automated provisioning systems (Ansible, Chef, Puppet, etc)
8 – Allows creation of private custom packages
First, Chocolatey requires the minimum of Windows 7 sp 1 with Powershell Version 3 or later. Windows 10 on up meets the minimum requirement..
Install via powershell
As administrator, run the following on powershell window:
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString(‘https://chocolatey.org/install.ps1’))
After you install chocolatey, you can add any package you want.
$ choco install firefox
It will install the latest version of firefox.
To update firefox,
$ choco upgrade firefox
It will update firefox to the latest version.
To list all of the packages you have installed on your machine.
$ choco list –local-only
84 packages installed.
This creates a list of all applications managed by chocolatey.
There are other things you can do with chocolatey such as creating your own packages, running your on repository and use tools like Ansible, Puppet or Chef to deploy these packages to your Windows machines. It’s beyond the scope of this article. I may cover this in a future article, just be aware it’s available.
Until then, have a good day.