Windows

Windows Package Manager: How to install Chocolatey

Chocolatey is a secure and simple Windows package manager. Windows package managers are a collection of tools that enable users to automate the installation, configuration, and updating of apps and programs. It is free and open-source for personal and business use. For users who need advanced functionality, Chocolatey offers premium upgrades.

What does Chocolatey bring?  Chocolatey Software Management Tool replaces the traditional way of searching for an .exe or .msi application file on a website, then download the installer before executing it and then following the rigorous process of clicking on several next etc., till the software is finally installed and then click on finish to end the installation process.

With  Chocolatey Software Management Tool, these steps have simplified and made easy to achieve the same with Command Prompt or PowerShell. We shall see this later as we install and uninstall packages quite easily.

For similar Windows Package Manager (Winget), see https://techdirectarchive.com/2020/05/23/winget-cli-how-to-install-windows-package-manager/
– For how to install applications with Windows Package Manager (Winget), see https://techdirectarchive.com/2020/05/23/winget-cli-how-to-install-applications-with-windows-package-manager/

Install Chocolatey: To install chocolatey, follow the steps below.
1: Install with PowerShell: You can install Chocolatey with PowerShell, but this requires an additional step. You must set the ExecutionPolicy.
– For more set the ExecutivePolicy, see https://techdirectarchive.com/2020/02/04/how-to-set-execution-policy/
– For to set the PowerShell Execution Policy via the registry settings, https://techdirectarchive.com/2020/02/04/how-to-set-the-powershell-execution-policy-via-the-registry-settings/

Note: Get-ExecutionPolicy is not restricted. To fix this, it is advisable to use the “Bypass” policy to let the script run.

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

Ensure to launch PowerShell with Administrative privilege and run the above code

Now, chocolately is installed on your server.

To see how to install, upgrade and uninstall software with Chocolatey, see https://techdirectarchive.com/2020/05/25/windows-package-manager-how-to-install-and-uninstall-software-with-chocolatey/

2: Via the Command Prompt: To run Chocolatey, launch Command Prompt withAdministrator privilege

– Next, copy the command below to the command prompt and click on 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"

This will ensure, Chocolatey is installed on to your server.


How to upgrade Chocolatey: Once installed, Chocolatey can be upgraded in exactly the same way as any other package that has been installed using Chocolatey. Simply use the command to upgrade to the latest stable release of Chocolate.

choco upgrade chocolatey

How to uninstall Chocolatey: Once installed, Chocolatey can be uninstalled in the following way by simply removing the folder and the environment variable(s) that are created on your device. Since it is not actually installed in Programs and Features, you don’t have to worry that it cluttered up your registry. However that’s a different story for the applications that you installed with Chocolatey or manually).

Most of Chocolatey is contained in C:\ProgramData\chocolatey or whatever $env:ChocolateyInstall evaluates to. You can simply delete that folder.

Note: Ensure the you check the box to show the “Hidden items” or else, the folder ProgramData will not be visitable.

For other installation scenarios, see the following link.

I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x