How to Install Chocolatey and Get Started in No Time

choubertsprojects

The Best WordPress plugins!

1. WP Reset

2. WP 301 Redirects

3. WP Force SSL

If you’ve never heard of it before, Chocolatey is a package manager for Windows. It makes installing programs and software easier by fetching packages from the official repositories so that they’re available on your computer. Want to install Git or MySQL? Just type “choco install git” or “choco install mysql”. This article will help you get started in no time!.

Chocolatey is a package manager that allows users to install and manage software in their computer. Chocolatey can be installed with just one command, which makes it easy for beginners to get started. Read more in detail here: uninstall chocolatey.

How to Install Chocolatey and Get Started in No Time

You’re in for a treat if you’re having trouble managing and maintaining software throughout your environment. In this post, you’ll learn how to install Chocolatey and organize your software packages.

You’ll learn how to install Chocolatey, manage software, and acquire a basic understanding of what makes this product tick in this tutorial.

How to Make Your First Chocolatey Package (Related)

Prerequisites

This is going to be a walkthrough instruction. If you intend on following along, make sure you meet the following requirements.

  • The lesson will run on Windows 10 version 1903.
  • Optional: Windows PowerShell 5.1 Despite the fact that Chocolatey does not need it, all examples in this article will utilize it.

Check out the Chocolatey Requirements page for a complete list of all technical requirements.

Chocolatey installation

The first step in getting started with Chocolatey is to download and install the Chocolatey client. Although Chocolatey includes a server component, you’ll be focused on utilizing the client to download, install, and update applications in this tutorial.

Chocolatey may be installed in a variety of methods. In this tutorial, you’ll discover the most typical method, which is to use PowerShell.

Check out the Chocolatey installation guide for a thorough discussion of how to install the Chocolatey client in a variety of methods.

Chocolatey comes has a PowerShell script that you may use to install it on your machine. Before you execute the installation script, make sure you examine it first. The script may be found here.

How to Run PowerShell as an Administrator is a related topic.

Download and run the script in one command using the PowerShell interface as administrator.

The following is a sample of code:

  • Ensures that PowerShell may traverse the chocolatey.org server’s SSL certificate.
  • The script is downloaded from https://chocolatey.org/install.ps1.
  • Once the script has been downloaded, it is run.
  • The ALLUSERSPROFILE% chocolateybin folder is added to the PATH environment variable.

SecurityProtocol = 3072 Invoke-Expression ( [System.Net.ServicePointManager]::SecurityProtocol = 3072 Invoke-Expression ( (New-Object System.Net.WebClient). DownloadString(‘https://chocolatey.org/install.ps1’)) SET “PATH=%PATH%;%ALLUSERSPROFILE%chocolateybin”

Chocolatey is being downloaded and installed.Chocolatey is being downloaded and installed.

You can come across an error that mentions an execution policy. If that’s the case, your current execution policy could prevent script execution. To fix this, make sure your execution policy is set to Unrestricted or RemoteSigned.

Checking the Installation

Once the PowerShell script has completed and you’ve returned to the PowerShell console, double-check that you can execute the choco.exe Chocolatey client.

As demonstrated below, when you run choco, you should see the installed version as well as some basic help information.

PS51> choco Chocolatey v0.10.15 Please run ‘choco -?’ or ‘choco <command> -?’ for help menu.~~

Obtaining Assistance

The Chocolatey CLI client’s help system is one of its greatest features. Chocolatey’s built-in help system performs a good job of detailing all of its features.

Provide the -? switch to the choco command to access the help system, as illustrated below.

As you can see, the Chocolatey client provides a number of commands that allow you to control software in a variety of ways.

PS51> choco -? This is a listing of all of the different things you can pass to choco. Commands * list – lists remote or local packages * find – searches remote or local packages (alias for search) * search – searches remote or local packages (alias for list) * info – retrieves package information. Shorthand for choco search pkgname –exact –verbose * install – installs packages from various sources * pin – suppress upgrades for a package * outdated – retrieves packages that are outdated. Similar to upgrade all –noop * upgrade – upgrades packages from various sources * uninstall – uninstalls a package * pack – packages up a nuspec to a compiled nupkg * push – pushes a compiled nupkg * new – generates files necessary for a chocolatey package from a template * sources – view and configure default sources (alias for source) * source – view and configure default sources * config – Retrieve and configure config file settings * feature – view and configure choco features * features – view and configure choco features (alias for feature) * setapikey – retrieves, saves or deletes an apikey for a particular source (alias for apikey) * apikey – retrieves, saves or deletes an apikey for a particular source * unpackself – have chocolatey set itself up * version – [DEPRECATED] will be removed in v1 – use `choco outdated` or `cup <pkg|all> -whatif` instead * update – [DEPRECATED] RESERVED for future use (you are looking for upgrade, these are not the droids you are looking for) Please run chocolatey with `choco command -help` for specific help on each command.

Check out the help system if you ever get stuck trying to find out how to do anything.

Searching for Packages

It’s time to explore what type of packages are accessible to install after you’ve had the Chocolatey client installed and running. List, search, and find are three commands in the client that enable you to do precisely that. These programs look for available packages in a Chocolatey repository or list packages on your workstation.

The breakdown and examples contained in the help system are shown below.

PS51> choco list –help List/Search Command Chocolatey will perform a search for a package local or remote. * choco list – lists remote or local packages * choco search – searches remote or local packages (alias for list) * choco find – searches remote or local packages (alias for search) Usage: choco search <filter> [<options/switches>] choco list <filter> [<options/switches>] clist <filter> [<options/switches>] Popular Switch –localonly or -lo Usage of -lo: choco <search,list,find> –localonly

An example of enumerating all packages (list) installed on a local machine is shown below (-lo).

PS51> choco list -lo Chocolatey v0.10.15 chocolatey 0.10.15 chocolatey-core.extension 1.3.3 GoogleChrome 77.0.3865.90 3 packages installed.

Before downloading, inspecting chocolatey packages

You should always know what a package performs before downloading it. Fortunately, you have the info command at your disposal. This command retrieves information about packages in a Chocolatey repository.

Package properties such as package author, download count, checksum, source, and more may be found using choco info.

Take a look at the running choco info alternatives below.

PS51> choco info –help Info Command Chocolatey will perform a search for a package local or remote and provide detailed information about that package. This is a synonym for `choco search <pkgname> –exact –detailed`. * choco info pkgname – retrieves package information. * Shorthand for choco search pkgname –exact –verbose * Shorthand for choco search pkgname –exact –detailed Usage: choco info [<options/switches>]

Let’s imagine you need to install Google Chrome and you see a package named googlechrome is accessible. Run the command choco info googlechrome to see what type of results you get.

PS51> choco info googlechrome Chocolatey v0.10.15 GoogleChrome 77.0.3865.90 [Approved] Downloads cached for licensed users Title: Google Chrome | Published: 9/18/2019 Package approved as a trusted package on Sep 18 2019 20:15:10. Package testing status: Passing on Sep 18 2019 18:45:17. Number of Downloads: 19851699 | Downloads for this version: 262131 Package url Chocolatey Package Source: <https://github.com/chocolatey-community/chocolatey-coreteampackages/tree/master/automatic/googlechrome> Package Checksum: ‘v7bDDUTo21k31xqUW+1amzaEWjeOqsEgS3txYNRgRaO3Q7ZnkzYz4S69AxTFn4r0HUB5Wi7NHXZBag/OaJTPKA==’ (SHA512) Tags: google chrome web internet browser admin Software Site: <https://www.google.com/chrome/browser/> Software License: <https://www.google.it/intl/en/chrome/browser/privacy/eula_text.html> Description: Chrome is a fast, simple, and secure web browser, built for the modern web.

Putting Packages Together

Enough with the packaging information. It’s finally time to install some applications! Choco instal is the tool you utilize for this.

Choco install is a powerful and necessary command. This is the one command you should memorize and become an expert at.

Once you know what you need, use the choco install command to install a package or a list of packages.

To discover what alternatives you have, run choco install —help.

PS51> choco install –help Install Command Installs a package or a list of packages Usage: choco install [ ] [] cinst [ ] [] Examples: choco install sysinternals choco install notepadplusplus googlechrome atom 7zip choco install notepadplusplus –force –force-dependencies choco install notepadplusplus googlechrome atom 7zip -dvfy choco install git -y –params=”‘/GitAndUnixToolsOnPath /NoAutoCrlf’” choco install git -y –params=”‘/GitAndUnixToolsOnPath /NoAutoCrlf’” –install-arguments=”‘/DIR=C:git’” # Params are package parameters, passed to the package # Install args are installer arguments, appended to the silentArgs # in the package for the installer itself choco install nodejs.install –version 0.10.35 choco install git -s “‘https://somewhere/out/there’” choco install git -s “‘https://somewhere/protected’” -u user -p pass

Keeping Chocolatey Boxes Up-to-Date

Once you’ve installed a package, you’ll want to make sure it’s up to date. Chocolatey has a strong trait in this regard.

Once you’ve installed a few packages, you’ll see that Chocolatey doesn’t merely keep packages updated in the background. The Chocolatey client does not operate in the background as a service.

You must manually execute choco every time you need to upgrade installed Chocolatey packages. To do so, use the choco upgrade command in conjunction with the upgrade package.

If the package does not exist on the system, the upgrade command will install it.

The breakdown and examples contained in the help system are shown below.

PS51> choco upgrade –help Upgrade Command Upgrades a package or a list of packages. Some may prefer to use cup as a shortcut for choco upgrade. If you do not have a package installed, upgrade will install it. Usage: choco upgrade [ ] [] cup [ ] [] Examples: choco upgrade chocolatey choco upgrade notepadplusplus googlechrome atom 7zip choco upgrade notepadplusplus googlechrome atom 7zip -dvfy choco upgrade git -y –params=”‘/GitAndUnixToolsOnPath /NoAutoCrlf’” choco upgrade git -y –params=”‘/GitAndUnixToolsOnPath /NoAutoCrlf’” –install-args=”‘/DIR=C:git’” Params are package parameters, passed to the package Install args are installer arguments, appended to the silentArgs in the package for the installer itself choco upgrade nodejs.install –version 0.10.35 choco upgrade git -s “‘https://somewhere/out/there’” choco upgrade git -s “‘https://somewhere/protected’” -u user -p pass choco upgrade all choco upgrade all –except=”‘skype,conemu’”

By executing choco upgrade all, you may update all of your packages to the most recent version.

Locating Out-of-Date Packages in Your Area

What if you want to see whether your package has been updated before you blindly run choco upgrade? You may still use the old command. The outdated tool looks for possible package updates by scanning your installed packages and comparing them to your specified package repository.

Take a peek at what choco outdated —help can do below.

PS51> choco outdated –help Outdated Command Returns a list of outdated packages. * outdated – retrieves packages that are outdated. Similar to upgrade all –noop Usage: choco outdated [<options/switches>] Examples: choco outdated choco outdated -s <https://somewhere/out/there> choco outdated -s “‘<https://somewhere/protected>’” -u user -p pass

For example, if you want to locate all of the out-of-date locally installed packages, you may use choco obsolete.

PS51> choco outdated Chocolatey v0.10.15 Outdated Packages Output is package name | current version | available version | pinned? Chocolatey has determined 0 package(s) are outdated.

Putting a Stop to Package Updates

It’s always a good idea to keep your software up to date, but what if you have packages that need you to do so explicitly? Why would you want to do anything like that?

Avoiding update repetition is one rationale for suppressing updates. For example, suppose you merely wanted to automate the first installation of a software. You don’t want to be responsible for the full software lifespan of the package.

When requiring Chocolatey to update all packages, you may need to add certain exceptions. You may pin shipments in such instance.

A pinned property will appear when you perform certain Chocolatey operations. When you execute the obsolete command, for example, you can easily see that attribute, as seen below.

PS51> choco outdated Chocolatey v0.10.15 Outdated Packages Output is package name | current version | available version | pinned?

The breakdown and examples contained in the help system are shown below.

PS51> choco pin –help Pin Command Pin a package to suppress upgrades. This is especially helpful when running `choco upgrade` for all packages, as it will automatically skip those packages. Another alternative is `choco upgrade –except=”pkg1,pk2″`. Usage choco pin [list]|add|remove [<options/switches>] Examples choco pin choco pin list choco pin add -n=git choco pin add -n=git –version 1.2.3 choco pin remove –name git * pin – suppress upgrades for a package

UnChocolatey installation Packages

Finally, you may have determined that you no longer need software installation. Rather than going into Control Panel and manually identifying and deleting the program, use the choco uninstall command to do it for you.

Choco uninstall is a command that removes one or more software packages all at once.

The help text below will show you how to use the choco uninstall command.

PS51> choco uninstall –help Uninstall Command Uninstalls a package or a list of packages. Usage: choco uninstall <pkg | all> [pkg2 pkgN] [options/switches] cuninst <pkg | all> [pkg2 pkgN] [options/switches] NOTE: `all` is a special package keyword that will allow you to uninstall all packages. Examples: choco uninstall git choco uninstall notepadplusplus googlechrome atom 7zip choco uninstall notepadplusplus googlechrome atom 7zip -dv choco uninstall ruby –version 1.8.7.37402 choco uninstall nodejs.install –all-versions

Before making any changes, it’s best to play it safe (choco whatif)

If not done correctly, automating software administration may be a disaster. Rather of making a lot of changes all at once, it’s a good idea to perform a test beforehand to see what might happen. Fortunately, the Chocolatey client includes a few options for doing so.

The What-If Option

Every choco command has the —whatif switch, which has the aliases —noop and —what-if. If these switches are used with a choco command, Chocolatey will tell you of what would have occurred instead of performing the action.

You can see an example below attempting to uninstall all packages on the local system but using The What-If Option to prevent actually doing anything.

PS51> choco uninstall all -whatif Chocolatey v0.10.15 _ Chocolatey:ChocolateyUninstallCommand – Noop Mode _ Would have uninstalled chocolatey v0.10.15. Would have uninstalled GoogleChrome v77.0.3865.90. Would have uninstalled chocolatey-core.extension v1.3.3.

Actions That Confirm

When you use choco install to install a package, you’ll usually be asked to confirm that you wish to proceed with the installation. Choco also asks for confirmation for any extra packages that are termed dependencies for your main package.

You can see an example of how Chocolatey encourages you to install Firefox before actually doing so in the video below.

PS51> choco install firefox Chocolatey v0.10.15 Installing the following packages: firefox By installing you accept licenses for the packages. Progress: Downloading Firefox 69.0.1… 100% Firefox v69.0.1 [Approved] firefox package files install completed. Performing other installation steps. The package Firefox 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):

Although the confirmation step is a safeguard, it may cause you to lose time. Add a switch of -y, —yes, or —confirm at the end of your command if you want the procedure to continue uninterrupted.

When executing tasks unattended, such as in a scheduled process, the -y option is useful.

Steps to Follow

Where do you proceed from here now that you know how to install Chocolatey and utilize it at a high level? Now try to think of a common piece of software that you have to install and update on a regular basis.

To get your feet wet with Chocolatey and learn more about this useful Windows package manager, try writing a script to handle that piece of software.

Chocolatey is a package manager for Windows that allows you to install and manage software packages. It has been in use since 2008, but it’s still not very well known. With this tutorial, you’ll be able to install Chocolatey on your computer in no time. Reference: install chocolatey on windows 10.

Related Tags

  • chocolatey packages
  • chocolatey gui
  • chocolatey install for all users
  • chocolatey install windows
  • chocolatey commands

Table of Content