chocolatey logo

Chocolatey install: A step-by-step guide

Ronald Caldwell
Tutorials

If you’re managing Windows systems and still installing software manually, you’re missing out. Chocolatey is the package manager that brings the speed and convenience of Linux-style installs to Windows—no more hunting down installers or clicking through endless setup wizards.

Whether you’re automating dev environments or just tired of repetitive installs, getting Chocolatey set up is a simple way to take control of your Windows workflow. Let’s walk through exactly how to get it running.

What is Chocolatey?

Chocolatey (or Choco as it is sometimes referred to) is a free, open-source package manager for Windows servers that is used to install software vis the Windows command line—very similar to Apt or DNF in the Linux realm. It downloads a program, installs it, and will then check for and automatically install updates as needed.

Those who use Linux are quite familiar with the package management systems like this.

Chocolatey benefits

Why use a program like Chocolatey on a dedicated server or cloud solution, when you can simply download the .exe or .msi software and install the program yourself? So glad you asked.

  1. Simplicity. When you install a new operating system and want to use numerous programs, you have to look for each program installer, download it, install it, and then regularly check for updates. The Chocolatey package manager this all by itself.
  2. Speed. Instead of searching for an executable installer, we can install the program using the Chocolatey package manager and complete everything using the command line. It is much more convenient and faster.
  3. Version control. We can conveniently and more comfortably control the application versions we need. Most often, when we go to download an executable for the application, it downloads the latest version for us, and we do not always need the latest version.
  4. Efficiency. Chocolatey provides clear, simple commands that are almost identically used in all package management systems.

Chocolatey install prerequisites

Ready to get started? Here’s what you need first:

  • Windows 7 or later / Windows Server 2003 or later
  • PowerShell v2 or later
  • .NET Framework 4 or later

(As an aside, the installation will attempt to install .NET 4.0 if you do not have it already installed.)

Chocolatey installation

There are two options for installing Chocolatey. We can install Chocolatey via the command line or through PowerShell. The option to use cmd is most often used for Windows, and PowerShell for running scripts. In this case, we can run both cmd and PowerShell, but as an administrator, for this installation.

Note: Please inspect the Chocolatey installation script before running it to ensure safety. Chocolatey already knows it’s scripts are safe, but by default, you should verify the security and contents of any script you are not familiar with, before downloading and running it from the internet. This installation downloads a remote PowerShell script and execute it on your machine. We take security very seriously.

1. Install Chocolatey using Powershell

When installing the software via PowerShell, we must ensure the local Get-ExecutionPolicy is not set to restricted. Chocolately suggests using Bypass to bypass the policy to get things installed or AllSigned for increased security.

First, run the Get-ExecutionPolicy. If it returns Restricted, run one of the two commands below.

Set-ExecutionPolicy AllSigned

OR

Set-ExecutionPolicy Bypass -Scope Process

Now run the following command in the Windows shell.

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')) 

If there are no errors, Chocolatey will be installed. You can verify the installation using the choco or choco -? command.

2. Install Chocolatey using Windows Cmd Shell

First, ensure that you’re using an administrative shell.

Next, copy the following command to the cmd.exe shell.

@"%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"

And then press Enter

The installation should look something like this:

Microsoft Windows [Version 10.0.18363.900]
(c) 2019 Microsoft Corporation. All rights reserved.
C:\WINDOWS\system32>@"%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"
Getting latest version of the Chocolatey package for download.
Getting Chocolatey from https://chocolatey.org/api/v2/package/chocolatey/0.10.15.
Extracting C:\Users\user\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip to C:\Users\user\AppData\Local\Temp\chocolatey\chocInstall...
Installing chocolatey on this machine
Creating ChocolateyInstall as an environment variable (targeting 'Machine')
Setting ChocolateyInstall to 'C:\ProgramData\chocolatey'
WARNING: It's very likely you will need to close and reopen your shell
before you can use choco.
Restricting write permissions to Administrators
We are setting up the Chocolatey package repository.
The packages themselves go to 'C:\ProgramData\chocolatey\lib'
(i.e. C:\ProgramData\chocolatey\lib\yourPackageName).
A shim file for the command line goes to 'C:\ProgramData\chocolatey\bin'
and points to an executable in 'C:\ProgramData\chocolatey\lib\yourPackageName'.
Creating Chocolatey folders if they do not already exist.
WARNING: You can safely ignore errors related to missing log files when
upgrading from a version of Chocolatey less than 0.9.9.
'Batch file could not be found' is also safe to ignore.
'The system cannot find the file specified' - also safe.
WARNING: Not setting tab completion: Profile file does not exist at
'C:\Users\user\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'.
Chocolatey (choco.exe) is now ready.
You can call choco from anywhere, command line or powershell by typing choco.
Run choco /? for a list of functions.
You may need to shut down and restart powershell and/or consoles
first prior to using choco.
Ensuring chocolatey commands are on the path
Ensuring chocolatey.nupkg is in the lib folder
C:\WINDOWS\system32>

Verify installation

To verify that Chocolatey is installed, use the choco command.

C:\WINDOWS\system32>choco
 Chocolatey v0.10.15
 Please run 'choco -?' or 'choco  -?' for help menu.
C:\WINDOWS\system32>

Excellent! Chocolatey is installed!

Advanced examples for installing Chocolatey

Install the Chocolatey graphical user interface (GUI)

Once Chocolatey is installed, it’s useful to install the GUI version, if desired. Use the following command for installation:

choco install chocolateygui

Install Chocolatey behind a proxy

If you need to install Chocolatey behind a proxy, use the following Windows Cmd command:

@powershell -NoProfile -ExecutionPolicy Bypass -Command "[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))" && SET PATH="%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

If you are using Windows PowerShell, ensure Get-ExecutionPolicy is at least set to RemoteSigned and run the following command:

[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

The Chocolatey documentation offers additional options for more complex configuration of this installation type.

Other software to install with Chocolatey

Chocolatey is useful for installing various software packages. Here are a few to get you started.

Google Chrome browser

The following command is used to install Google Chrome with Chocolatey:

choco install chrome

Git

Use the following command to install the Git command line (cli) Client for Windows:

choco install git

GitHub

This command installs GitHub, the official GUI-based client for Git:

choco install github

Putty

The next command installs the popular open source SSH client, Putty:

choco install putty

VLC

Use this command to install VLC, the open source media player:

choco install vlc

Basic Chocolatey commands

Now let’s review some of the basic commands for using Choco. Choco commands can be used in both the Windows cmd shell and in PowerShell.

Install program

To install a specific program, use:

choco install <pkg|packages.config> [ ] []</pkg|packages.config>

For example:

choco install chrome

For a complete listing of install options, visit the Choco install page or run the following command:

choco install -h

Update program

To update a program, use:

choco upgrade <pkg|all> [ ] []</pkg|all>

For example:

сhoco upgrade chrome

Update all programs

To update all programs, use:

cup <pkg|all> [ ] []</pkg|all>

OR

choco upgrade all

If you noticed, the cup command is an alternative to using the choco upgrade command.

Search for a program

To find a needed program for downloading and installation, enter:

choco search chrome

See installed programs

Using the following command, you can see which programs are already installed using Choco:

choco list --local-only
 Chocolatey v0.10.15
 chocolatey 0.10.15
 chocolatey-core.extension 1.3.3
 kubernetes-cli 1.18.2
 Minikube 1.10.1
 vscodium 1.38.0
 5 packages installed.
C:\WINDOWS\system32>

Update Chocolatey

Update the Choco program itself using:

choco upgrade chocolatey

It is important to do this periodically because in previous versions, errors may be detected, and they need to be fixed so that there are no vulnerabilities.

Install the Chocolatey GUI

If someone is not comfortable using the command line, install the graphical user interface of Chocolatey using:

choco install chocolateygui

Getting started with a Chocolatey install

As you can see, using Chocolatey is very simple. Overall, Chocolatey is an excellent tool in your systems administration toolbox. It is reliable, definitive, and consistently updated. It is an exceptional product.

Do you need to set up a Windows server for use with Chocolatey? Liquid Web’s Windows hosting options for VPS hosting and dedicated servers give you what you need for development or production workloads.

Chat with an expert

Related articles

Wait! Get exclusive hosting insights

Subscribe to our newsletter and stay ahead of the competition with expert advice from our hosting pros.

Loading form…