Posts Using chocolatey for windows
Post
Cancel

Using Chocolatey for Windows

Windows logo with a plus sign followed by chocolatey logo

Intro

Well, let’s begin with the basic question: “What would Chocolatey be?”. Just as simple as the question, is the answer: “It is a package manager developed for Windows”.

Yes, we have now (not exactly now, because this project has been rolling approximately since 2014) a package manager for Windows like apt-get or yum for Linux, or Homebrew for Mac. And just as the mentioned, we can use it in infrastructure automation tools (or IaC — Infrastructure as code) like Puppet, Chef or Ansible.

Requirements

  • Windows 7 or higher / Windows Server 2003 or higher

  • Powershell v2 or higher

  • .NET Framework 4 or higher (the Chocolatey installation will try to install this dependency in case you don’t have it)

Installing

First thing to do is run as administrator Powershell or Cmd, to do so, search for Powershell or Cmd in Start Menu, right button click and select “Run as Administrator”.

For Powershell use the following command line:

1
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

For Cmd use this command line:

1
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

Usage

And… done, the installation was just that. Now let’s have a look at the basic commands to manage packages:

Search packages

1
choco search $package_approximate_name

or visit https://chocolatey.org and search

List installed packages

1
choco list --local-only

Installing packages

1
choco install $package_name

note.: Use -y if you wish to ignore the confirmation messages

Removing packages

1
choco uninstall $package_name

note.: Use -y if you wish to ignore the confirmation messages

Updating packages

1
choco upgrade $package_name

to update all your packages use:

1
choco upgrade all

note.: Use -y if you wish to ignore the confirmation messages

Conclusion

Chocolatey came to ease our life as Windows users and specially Windows administrators. Also made Windows environments more viable when using devops CI/CD tools.

See you soon!

This post is licensed under CC BY 4.0 by the author.