Cyberithub

How to Install Chocolatey on Windows 10 [Easy Steps]

Advertisements

In this article, we will see how to install chocolatey on Windows 10 using just few easy steps. If you are looking for Linux type of package management solution in Windows then chocolatey is the best you can think of. It not only makes the software installation easier but also allows us to get rid of the time consuming solution. With its rich set of features enabled, it is very easy to automate DevOps solution using chocolatey which otherwise is a cumbersome and frustrating process in Windows. It is also very flexible to install using just a PowerShell script. Here we are going to see the steps to install Chocolatey on Windows 10 System.

 

Important Features

  • Easy to install Software
  • Save lot of time and effort
  • Suitable to use in DevOps automation solution
  • Better in managing installers, scripts and runtimes in Windows
  • Integrates with other DevOps tools like puppet, chef etc
  • Can be used to work with registry settings and configurations

How to Install Chocolatey on Windows 10 [Easy Steps]

How to Install Chocolatey on Windows 10 [Easy Steps]

Also Read: How to Install Wireshark on Windows 10 [Step by Step]

Advertisements

Step 1: Prerequisites

a) You should have a running Windows 10 System.

b) You should have an active Internet connection to download a package.

Advertisements

c) You should have administrator or equivalent access to install a package from PowerShell.

 

Step 2: Install Chocolatey

You can visit Chocolatey official website and get the latest PowerShell step to download and install Chocolatey software management solution in your System.

Advertisements
PS C:\> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Forcing web requests to allow TLS v1.2 (Required for requests to Chocolatey.org) Getting latest version of the Chocolatey package for download. Not using proxy. Getting Chocolatey from https://community.chocolatey.org/api/v2/package/chocolatey/1.2.0. Downloading https://community.chocolatey.org/api/v2/package/chocolatey/1.2.0 to C:\Users\bholu\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip Not using proxy.
Extracting C:\Users\cyberithub\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip to C:\Users\cyberithub\AppData\Local\Temp\chocolatey\chocoInstall
Installing Chocolatey on the local 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.
chocolatey.nupkg file not installed in lib.
Attempting to locate it from bootstrapper.
PATH environment variable does not have C:\ProgramData\chocolatey\bin in it. Adding...
WARNING: Not setting tab completion: Profile file does not exist at 'C:\Users\cyberithub\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

 

Step 3: Check Version

After successful installation, you can restart your PowerShell and check the installed version by using choco --version command as shown below.

PS C:\> choco --version
1.2.0

 

Step 4: Using Chocolatey

Now that chocolatey is installed in the System, you can use it to install a package in your Windows system by using choco install <package_name> syntax. For example - here we are installing a package called dart-sdk using choco install dart-sdk command as shown below.

Advertisements
PS C:\> choco install dart-sdk
Chocolatey v1.2.0
Installing the following packages:
dart-sdk
By installing, you accept licenses for the packages.
Progress: Downloading dart-sdk 2.18.3... 100%

dart-sdk v2.18.3 [Approved]
dart-sdk package files install completed. Performing other installation steps.
The package dart-sdk wants to run 'chocolateyInstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint): y

PATH environment variable does not have C:\tools\dart-sdk\bin in it. Adding...
PATH environment variable does not have C:\Users\cyberithub\AppData\Roaming\Pub\Cache\bin in it. Adding...
Downloading dart-sdk 64 bit
from 'https://storage.googleapis.com/dart-archive/channels/stable/release/2.18.3/sdk/dartsdk-windows-x64-release.zip'
Progress: 100% - Completed download of C:\Users\cyberithub\AppData\Local\Temp\dart-sdk\2.18.3\dartsdk-windows-x64-release.zip (178.41 MB).
Download of dartsdk-windows-x64-release.zip (178.41 MB) completed.
Hashes match.
Extracting C:\Users\cyberithub\AppData\Local\Temp\dart-sdk\2.18.3\dartsdk-windows-x64-release.zip to C:\tools...
C:\tools
Environment Vars (like PATH) have changed. Close/reopen your shell to
see the changes (or in powershell/cmd.exe just type `refreshenv`).
The install of dart-sdk was successful.
Software installed to 'C:\tools'

Chocolatey installed 1/1 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

 

Step 5: Uninstall a Package

If you are done using a package then you can choose to uninstall it from the System by using choco uninstall <package_name> command. For example, to remove dart-sdk package, you can use choco uninstall dart-sdk command as shown below.

PS C:\> choco uninstall dart-sdk
Chocolatey v1.2.0
Uninstalling the following packages:
dart-sdk

dart-sdk v2.18.3
The package dart-sdk wants to run 'chocolateyUninstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint): Y

WARNING: Get-BinRoot was deprecated in v1 and will be removed in v2. It has been replaced with Get-ToolsLocation (starting with v0.9.10), however many packages no longer require a special separate directory since package folders no longer have versions on them. Some do though and should continue to use Get-ToolsLocation.
Skipping auto uninstaller - No registry snapshot.
dart-sdk has been successfully uninstalled.

Chocolatey uninstalled 1/1 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

 

Step 6: Upgrade a Package

You can also upgrade any package to the latest version by using choco upgrade <package_name> command. In this example, we are upgrading dart-sdk package by using choco upgrade dart-sdk command as shown below.

PS C:\> choco upgrade dart-sdk
Chocolatey v1.2.0
Upgrading the following packages:
dart-sdk
By upgrading, you accept licenses for the packages.
dart-sdk v2.18.3 is the latest version available based on your source(s).

Chocolatey upgraded 0/1 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

 

Step 7: Check all Available Options

If you want to check all the commands and parameters that can be used with choco, you need to use choco /? command as shown below.

PS C:\> choco /?
This is a listing of all of the different things you can pass to choco.

DEPRECATION NOTICE

The shims `chocolatey`, `cinst`, `clist`, `cpush`, `cuninst` and `cup` are deprecated.
We recommend updating all scripts to use their full command equivalent as these will be
removed in v2.0.0 of Chocolatey.

Options and Switches

-v, --version
Version - Prints out the Chocolatey version. Available in 0.9.9+.

Commands

* apikey - retrieves, saves or deletes an apikey for a particular source
* config - Retrieve and configure config file settings
* export - exports list of currently installed packages
* feature - view and configure choco features
* features - view and configure choco features (alias for feature)
* find - searches remote or local packages (alias for search)
* help - displays top level help information for choco
* info - retrieves package information. Shorthand for choco search pkgname --exact --verbose
* install - installs packages using configured sources
* list - lists remote or local packages
........................................

Leave a Comment