One thing I have been meaning to write for a while now is around what I use to build out my templates from a software point of view, this could be the windows workstation or my windows server templates.
From a Mac-OS perspective I use HomeBrew but I wanted to focus this on the windows side of things because there is not a great deal of options when it comes to Windows Packet Management. My go to has been Chocolatey.
For those in the Linux world you can skip this one from the opening introduction, you guys have had yum for a while…
The first scary warning is that it does involve the scary command prompt window (again see last message, if you are looking into saving time and effort then you are well versed in the art of leveraging command line functionality and PowerShell in your windows environments as a start.
Using Chocolatey For Windows Package Management
Chocolatey is FREE and an Open Source package manager for Windows, as I said if you have ever administered Linux this will look very familiar to you.
In general, package managers are great for installing and managing multiple programs at the same time. Chocolatey do offer a pro-business version but I would expect for the most the free version is all we need.
To get started we need to head on over to the Chocolatey site which can be found at https://chocolatey.org/
You will see the “Install Chocolatey Now” you have two options here to begin the install from this page, either command line or PowerShell. Both commands can be copied from this page into your machine.
In your clipboard you will have either the command line text or the PowerShell, open the relevant shell up and paste that command in. Remember to open as an Administrator account.
Next you hit enter on that command in either shell to start the simple installation process.
That’s it, Chocolatey is installed, to begin using or doing anything we need to close this window and open either PowerShell or the Command Line back up.
Windows Package Management With Chocolatey
We are now ready to leverage the power of this package manager and start installing some software. To view the packages available for install you can visit – https://chocolatey.org/packages there are currently over 6000 packages available. A note here is that these are community maintained packages.
The first thing to show is how to install a single program, we can then get into the multiple programs piece which is generally where I use this package manager when building out my templates or my workstations.
Search for the program on the site that you wish to install and that is not currently installed on your system. I am going to choose NotePad ++
You will need to copy the command line text for either PowerShell or the Command Line, copy or type that into your workstation.
Hit enter and the download will begin but it will prompt you to run the installation script. Select Yes to proceed.
NotePad ++ is successfully installed.
If you wanted to bypass that prompt, then a simple -y would bypass that prompt and go ahead with the installation. Below shows the automated installation of Git.
Ok so that’s great, it removed the next next next of clicking through a wizard to install both of those software packages, but what it also does is remove the time it takes to navigate to those vendor sites and download the latest packages.
Let’s move onto the multiple program’s scenario. This is the perfect way to get that fresh image or server build to a state that you want without too much effort at all.
First up you most likely have that list of software somewhere of all the things you want on your personal machine or server build, open up the notepad ++ we just installed, and we can start creating this multiple program build list.
Search through the packages on the site to find the install command for the software you require and add them to the list. I have selected a few below that I wish to install.
If you want to avoid being prompted to agree to the license terms for every program type -y at the end of your text so the software installation.
Copy that text to your PowerShell or Command Line window and hit enter.
My list had an error with one of the packages, I wanted to show this because this is Windows, but the log is clear that “Another installation currently in progress try again later.” Relates to the msiexec.exe being in use at the time. This is one consideration you may have to make when creating your lists.
Let’s fix that putty install by running that same command again.
I could take a video and show you how quick this is or could just download and give it a try for yourselves but running this command took less than a minute which is a lot quicker than going to each package website and downloading their software individually.
Upgrades / Updates
It doesn’t stop there though, obviously there will be updates to these packages over time. We want to make sure we have the latest software on our systems, the following command can be ran to achieve the checking of this for all packages or you could use individual packages instead of the ‘all’
Obviously, I just ran these already, so you would expect them all to be up to date.
It is also very simple to uninstall a package, if I wanted to now remove a package we could run the following to remove that from the system.
If you found the post useful for then let me know also I would love to hear your impressions of chocolaty for windows package management. Apologies for the picture quality I will look to change the way they are shown within the posts.