Windows has come a long way in its journey of particularly powering personal computers and servers. Dating to the era of MS DOS to the current development of latest features, it is clearly noticeable that much has been done and huge strides have been made to make the Opeating System what it is today. Being the most widely used Operating System in personall computers, Windows users can benefit a lot from a tool like Chocolatey to install and generally manage their softwares.
Instead of the traditional way of looking for an EXE or MSI application file on a website, downloading it then installing it by clicking “Next, Next, Next” to the end, Chocolately makes it so easy to achieve the same with your Command-Line or PowerShell. We shall see this later as we install and uninstall packages quite easily.
This guide takes a look at Chocolately and the benefits that it provides to the ones who will choose to use it.
To begin with, Chocolatey, which is an OpenSource project, was created by Rob Reynolds in 2011 with the simple goal of offering a universal package manager for Windows. It is an open source project that provides developers and admins alike a better way to manage Windows software.
With more versions of software to support and endless updates, the company’s goal was to help their customers become efficient and innovative software-driven organizations.
- Windows 7+ / Windows Server 2003+
- PowerShell v2+ (Not PowerShell Core yet though)(minimum is v3 for install from source website due to TLS 1.2 requirement)
- .NET Framework 4+ (the installation will attempt to install .NET 4.0 if you do not have it installed)
In order for us to use Chocolatey, we will have to install it. We shall use both Commandline and PowerShell to get it running in your computer. If you would wish to follow along, just follow the steps below to get Chocolatey installed.
Step 1: Installing Chocolatey
In this step we are going to use two options to install Chocolatey.
Option 1: Installing Chocolatey via Commandline
Hit your “Windows” keyboard button and search for “command“. That will highly likely bring up the application. Right-click on it and choose “Run as Administrator”. On Windows 10, the option appears after searching the “command” application. Simply click on it. This is illustrated below:
After the application is up, copy the command below in it and hit enter.
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command " [System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
Option 2: Installing via PowerShell
Hit your “Windows” keyboard button and search for “powershell“. That will highly likely bring up the application. Right-click on it and choose “Run as Administrator“. On Windows 10, the option appears after searching “Powershell” application just like in option 1. Simply click on it. This is illustrated below as well:
After the application is up, copy the command below and hit enter.
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'))
Once the command runs to completion, you can simply run the command below to check the version installed.
Step 2: Using Chocolatey
Now we are in the section that we have been waiting for and let us plunge right in.
Once the commands run to completion, Chocolatey is fantastically installed and we are ready to cruise in this wonderfull world of installing packages very efficiently.
Checking/Searching for an application using Chocolatey
Let us say you would wish to install VLC Media player using Chocolatey. The first thing is to check if the application exists. Fire up your commandline or Powershell just like in Step 1 if it is not already running. Then proceed to check for the application by running “choco list ” as illustrated below:
choco search visualstudiocode
Sample screenshot with the results is shown below:
Installing an application with Chocolatey
Since we are convinced that the application is available, let us go ahead and install it. You do:
choco install vlc -y
Sample screenshot with what to expect shown below.
You can also install multiple installations at a go like so.
choco install vlc visualstudiocode -y
Uninstalling a package
In case you would wish to remove a package from your computer, Chocolatey comes with intuitive command to accomplish that for you. We know you have already guessed it and you are righ. Just do choco uninstall . Let us uninstall nodejs that I had installed on my computer.
choco uninstall nodejs
Upgrading a package
Similar to other commands, uprading an application is a simple task with Chocolatey. You simply run choco upgrade . As an example, let us upgrade vlc
choco upgrade vlc
As you might imagine, Chocolatey has much more to offer apart from the basics we have covered. You can integrate it with automation tools such as Puppet and achieve more with it. There is an Enterprise edition as well with many more features for organizations to enjoy. To find out much more about Chocolatey, the best place to invest your time is in Chocolatey Documentation.