How to Install Chocolatey on Windows 10

Chocolatey is a package manager for Windows 10 that simplifies software installation and management. It allows users to easily discover, download, and install thousands of software packages using a command-line interface. With Chocolatey, users can automate the installation process, reducing the risk of human error and saving time.

Chocolatey provides a centralized repository of software packages, which are verified and validated to ensure they are free from malware and viruses. This makes it a secure and reliable way to manage software on Windows 10 machines. Additionally, Chocolatey allows users to easily update and uninstall software packages, making it a convenient tool for maintaining software dependencies.

In this article, we will cover the installation process of Chocolatey on Windows 10, including the necessary commands and configuration options.

Installing Chocolatey on Windows 10 using Command Prompt (CMD)

For those who have installed NodeJS on Windows know that Chocolatey comes preinstalled on NodeJS. To separately install Chocolatey Windows using Command Prompt, follow these steps:

Step 1: Open Command Prompt as Administrator

To open Command Prompt as an administrator, right-click on the Start button and select “Command Prompt (Admin)” or type “cmd” in the search bar and right-click on the result to select “Run as administrator”.

Step 2: Execute the Installation Command

Once the Command Prompt is open, execute the following command:

@"%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://community.chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
not-using-proxy

The output indicates that the installation process was completed successfully. Here’s a breakdown of the key steps and messages:

  • TLS v1.2 enabled: The script forced web requests to allow TLS v1.2, which is required for requests to Chocolatey.org.
  • Chocolatey package downloaded: The script downloaded the latest version of the Chocolatey package (2.3.0) from the Chocolatey API.
  • Package extracted and installed: The script extracted the package to a temporary location and installed Chocolatey on the local machine.
  • Environment variable set: The script created a ChocolateyInstall environment variable and set it to C:\ProgramData\chocolatey.
  • Repository setup: The script set up the Chocolatey package repository and created the necessary folders.
  • Shim file created: The script created a shim file for the command line in C:\ProgramData\chocolatey\bin.
  • PATH environment variable updated: The script added C:\ProgramData\chocolatey\bin to the PATH environment variable.
  • CLI ready: The script announced that the Chocolatey CLI (choco.exe) is now ready to use.

Warnings and Notes

There are two warnings and a note in the output:

  • Warning: Close and reopen shell: The script warns that you may need to close and reopen your shell before you can use Choco.
  • Warning: Profile file does not exist: The script warns that the profile file does not exist at C:\Users\Taimo\OneDrive\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1, so it did not set up tab completion.

Note: Restart PowerShell and/or consoles: The script notes that you may need to shut down and restart PowerShell and/or consoles before using Choco.

To verify that Chocolatey was installed successfully, you need to open a new prompt as an administrator. After that run the following command:

choco -v
choco-v


If the installation was successful, you should see the version of Chocolatey installed on your system.

Installing Chocolatey using PowerShell

To install Chocolatey by using PowerShell, follow these steps:

Step 1: Open PowerShell as Administrator

To open PowerShell as an administrator, right-click on the Start button and select “Windows PowerShell (Admin)” or type “PowerShell” in the search bar and right-click on the result to select “Run as administrator”.

Step 2: Check the Execution Policy

Before Chocolatey Windows installs, you need to ensure that the execution policy is not restricted. Run the following command:

Get-ExecutionPolicy
get-policy


This command will return the current execution policy. If it returns “Restricted”, you need to change it to “AllSigned” or “Bypass” to install Chocolatey.

Step 3: Set the Execution Policy

If the execution policy is restricted, run one of the following commands to change it:

Set-ExecutionPolicy AllSigned
all-signed

or

Set-ExecutionPolicy Bypass
set-bypass

The “AllSigned” policy requires all scripts to be signed by a trusted publisher, while the “Bypass” policy bypasses all restrictions.

Step 4: Install Chocolatey

Once the execution policy is set, run the following command to install Chocolatey:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iwr https://community.chocolatey.org/install.ps1 -UseBasicParsing | iex
set-execution

Real-World Use Cases for Chocolatey

Chocolatey is a powerful package manager that can be used in a variety of scenarios, including:

  • DevOps and Continuous Integration: Chocolatey can be used to automate the installation of software dependencies and tools in your DevOps pipeline, ensuring that your development environment is consistent and reproducible.
  • IT and System Administration: Chocolatey can be used to manage software installations and updates across your organization, simplifying the process of keeping your systems up-to-date and secure.
  • Personal Productivity: Chocolatey can be used to automate the installation of software and tools on your personal computer, saving you time and effort.

Common Chocolatey Commands

Here are some common Chocolatey commands that you may find useful:

  • choco install: Installs a package and its dependencies.
  • choco upgrade: Upgrades a package to the latest version.
  • choco uninstall: Uninstalls a package and its dependencies.
  • choco search: Searches for packages in the Chocolatey repository.

Chocolatey Integrations

Chocolatey integrates with a variety of tools and platforms, including:

  • PowerShell: Chocolatey can be used directly from PowerShell, allowing you to automate package installations and updates.
  • Visual Studio: Chocolatey can be used to manage software dependencies and tools in your Visual Studio projects.
  • Docker: Chocolatey can be used to manage software installations and updates in your Docker containers.

Best Practices for Using Chocolatey

Here are some best practices for using Chocolatey:

  • Use the latest version of Chocolatey: Make sure you are using the latest version of Chocolatey to take advantage of new features and security updates.
  • Use secure sources: Only install packages from trusted sources to ensure that your system remains secure.
  • Keep your packages up-to-date: Regularly update your packages to ensure that you have the latest security patches and features.

Conclusion

In this article, we explored two methods for installing Chocolatey on Windows 10, using Command Prompt and PowerShell. Both methods are straightforward and require only a few steps to complete. The Command Prompt method involves executing a single command to download and install Chocolatey, while the PowerShell method requires setting the execution policy and then running a command to install Chocolatey.

Regardless of the method used, the end result is the same: a successful installation of Chocolatey on your Windows 10 system. With Chocolatey installed, you can easily manage packages and dependencies, making it a valuable tool for developers and system administrators alike. By following the steps outlined in this article, you can quickly and easily get started with Chocolatey and begin taking advantage of its powerful package management capabilities.

Installing Chocolatey on Windows 10 can streamline software management but it might face limitations on personal systems. Upgrading to Ultahost Windows 10 VPS offers a more robust and flexible environment that provides dedicated resources ensuring optimal performance for Chocolatey package installations and updates.

FAQ

What is Chocolatey?
Why Should I Use Chocolatey?
Do I Need to Restart My Computer After Installation?
What Permissions Are Required?
Can I Install Chocolatey Using Windows PowerShell?

Related Post

How to Install VLC Media Player on Windows

VLC Media Player or simply VLC has become ass...

How to Install MATLAB on Windows

MATLAB a powerful numerical computing environment and p...

How to Create a Batch Script: Step-by-Step Gu

The command prompt, which has been a Windows feature&nb...

How to Install Composer on Windows 10

In modern PHP development, managing external libraries ...

How to Install TeamViewer on Windows

TeamViewer is a powerful remote access and control tool...

How to Install VirtualBox in Windows 10

VirtualBox a free and open-source virtualization softwa...

Leave a Comment