Chocolatey in Windows 10

Finally, there is a Package Manager like apt-get install in ubuntu in Windows environment called Chocolatey

Please refer to the following simple guide on how to use Chocolatey

Install Chocolatey in Windows 10

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

Look for Package to install
You can easily get the Applications that you want via
https://chocolatey.org/packages and install it by following the commands provided

Install Package
I would like to put -y to let the command completed automatically

choco install googlechrome -y

Useful Commands
1. choco list –local-only #list locally installed packages
2. choco sources #List Source Repository

You can also download Choco GUI via https://chocolatey.org/packages/ChocolateyGUI if you pefer to manage choco in GUI rather than CLI
Summary of my study notes from https://chocolatey.org/docs/getting-started

What are Chocolatey Package
Chocolatey packages are known as nupkg files, which is a compiled NuSpec or a fancy zip file that knows about package metadata (including dependencies and versioning). These packages are an enhanced NuGet package, they have additional metadata that is specific to Chocolatey. Chocolatey is also compatible with vanilla NuGet packages. A Chocolatey package can contain embedded software and/or automation scripts.

How does Chocolatey work?
A. Installation
1. Chocolatey uses NuGet (NuGet.Core.dll) to retrieve the package from the source
2. The package is installed into $env:ChocolateyInstall\lib\
3. Choco takes a registry snapshot for later comparison
4. Choco compares the snapshot and determines uninstaller information and saves that to a .registry file.
5. Choco snapshots the folder based on all files that are currently in the package directory.

B. Upgrade
1. Similar to install, except choco will make a backup of the package folder (and only the package folder) prior to attempting upgrade.
2. The files snapshot is used to determine what files can be removed from the package folder. If those files have not changed, they will be removed. If the upgrade fails, choco will ask if you want to rollback the package folder to the previous version

C. Uninstall
1. Choco will make a backup of the package folder.
2. If auto uninstaller is turned on, choco will attempt to run the auto uninstaller if a silent uninstall can be determined.
3. If everything is successful so far, the files snapshot is used to determine what files can be removed from the package folder
4. If everything is deleted from the package folder, the folder is also removed.

Leave a Comment