+3 votes
416 views
Chocolatey: the package manager for Windows

in Windows 10 by (551k points) | 416 views

1 Answer

+4 votes
Best answer

INSTALL CHOCOLATEY

If you work with Linux or Mac you are more than used to installing and managing applications from the operating system terminal. In Windows it is less frequent, but there are times when such a tool can be really useful, especially when it comes to automating . For this reason, today I would like to tell you about  Chocolatey, a package manager for Windows, supported by PowerShell and the Nuget infrastructure.

INSTALL CHOCOLATEY

To start installing packages from the terminal with this manager, the first thing you should do is open the console as administrator and launch the following command:

one
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
Installing Chocolatey as administrator
Installing Chocolatey as administrator

With this you will install Chocolatey and add it to the environment variables so you can use it from anywhere. Note that if you did not launch this command as administrator it will only be available to the user who launched the installation.

You can also install it from PowerShell with the following command:

one
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))

In this case keep in mind that you must have previously launched Set-ExecutionPolicy Unrestricted to be able to execute the previous line.

Once the manager is installed, you can now install and automate the installation of different tools from the command line. On the official page  you have a search engine to locate those you need to know what the name of the package is.

Chocolatey website packages
Chocolatey website packages

As you can see, the way to install them is very simple, you simply must use the choco command, followed by install and the name of the package.

one
choco install package_name

For example, to install Skype you could do it from the following command.

one
choco install skype

When this action is launched there is a script to execute, but it is always possible to view it on the screen to check the actions that will be carried out.

Chocolatey print script
Chocolatey print script

Keep in mind that if you do not launch the commands as administrator, you could get errors from the installation, as reported in a console without elevated privileges.

Chocolatey detected you are not running from an elevated command shell
Chocolatey detected you are not running from an elevated command shell

Once the installation is accepted, it will begin to download the necessary packages and will log in chocolatey.log  all the steps followed during the process.

Chocolatey - The install of skype was successful
Chocolatey - The install of skype was successful

To remove packages installed by the manager, you can do it through the uninstall action.

one
choco uninstall skype

If you want to know how many packages you have installed using Chocolatey, just launch the list command in local mode only.

one
choco list --local-only

You already know how to start working with this simple package manager for Windows. How many installations can you automate?

Cheers!


by (551k points)

Related questions

+5 votes
1 answer
+4 votes
1 answer
asked Sep 22, 2020 in Windows 10 by backtothefuture (551k points) | 264 views
+3 votes
1 answer
asked Feb 28, 2020 in Windows 10 by backtothefuture (551k points) | 776 views
+5 votes
1 answer
asked May 26, 2021 in Windows 10 by backtothefuture (551k points) | 124 views
+5 votes
1 answer
asked Apr 7, 2021 in Windows 10 by backtothefuture (551k points) | 130 views
Sponsored articles cost $40 per post. You can contact us via Feedback
10,634 questions
10,766 answers
510 comments
3 users