Blog de programación, errores, soluciones

Chose Language:
comments
Author: Admin/Publisher |finished | checked

‘Chocolatey’ a package manage for windows

You may often come across commands like ‘choco install ‘ if you’re in the programming world. However, even if you’re not in the programming world, this package manager can also be useful because if we install programs in the traditional way, there are always leftover installers in our Downloads folder.

Lastly, and not less importantly, keep in mind that when we are installing packages, they may depend on others, and Chocolatey will install those for us.

Instalación

To install Chocolatey, you will need to check that Get-ExecutionPolicy is not restricted. You can do this by opening your PowerShell as an administrator and entering the following code:

Power Shell
Get-ExecutionPolicy
Restricted

If the result of running the command shows ‘Restricted’, you will need to execute the following command to unrestrict it.

Power Shell
Set-ExecutionPolicy AllSigned
Cambio de directiva de ejecución
La directiva de ejecución te ayuda a protegerte de scripts en los que no confías. Si cambias dicha directiva, podrías
exponerte a los riesgos de seguridad descritos en el tema de la Ayuda about_Execution_Policies en
https:/go.microsoft.com/fwlink/?LinkID=135170. ¿Quieres cambiar la directiva de ejecución?
[S] Sí  [O] Sí a todo  [N] No  [T] No a todo  [U] Suspender  [?] Ayuda (el valor predeterminado es "N"):

The response to this should be ‘y’, and it should be unrestricted afterward.

Now we will proceed to install Chocolatey.

Power Shell
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Forcing web requests to allow TLS v1.2 (Required for requests to Chocolatey.org)
Getting latest version of the Chocolatey package for download.
Not using proxy.
Getting Chocolatey from https://community.chocolatey.org/api/v2/package/chocolatey/1.1.0.
Downloading https://community.chocolatey.org/api/v2/package/chocolatey/1.1.0 to C:\Users\luisg\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip
Not using proxy.
Extracting C:\Users\luisg\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip to C:\Users\luisg\AppData\Local\Temp\chocolatey\chocoInstall
Installing Chocolatey on the local machine
Creating ChocolateyInstall as an environment variable (targeting 'Machine')
  Setting ChocolateyInstall to 'C:\ProgramData\chocolatey'
WARNING: It's very likely you will need to close and reopen your shell
  before you can use choco.
Restricting write permissions to Administrators
We are setting up the Chocolatey package repository.
The packages themselves go to 'C:\ProgramData\chocolatey\lib'
  (i.e. C:\ProgramData\chocolatey\lib\yourPackageName).
A shim file for the command line goes to 'C:\ProgramData\chocolatey\bin'
  and points to an executable in 'C:\ProgramData\chocolatey\lib\yourPackageName'.

Creating Chocolatey folders if they do not already exist.

WARNING: You can safely ignore errors related to missing log files when
  upgrading from a version of Chocolatey less than 0.9.9.
  'Batch file could not be found' is also safe to ignore.
  'The system cannot find the file specified' - also safe.
chocolatey.nupkg file not installed in lib.
 Attempting to locate it from bootstrapper.
PATH environment variable does not have C:\ProgramData\chocolatey\bin in it. Adding...
ADVERTENCIA: Not setting tab completion: Profile file does not exist at
'C:\Users\luisg\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'.
Chocolatey (choco.exe) is now ready.
You can call choco from anywhere, command line or powershell by typing choco.
Run choco /? for a list of functions.
You may need to shut down and restart powershell and/or consoles
 first prior to using choco.
Ensuring Chocolatey commands are on the path
Ensuring chocolatey.nupkg is in the lib folder

Now that we have it installed, we can check if it’s installed in our CMD console with the simple command ‘choco -?’. This will give us the version and different flags that we can use with Chocolatey.

choco -?

What can I install with Chocolatey?

This package manager offers a wide range of packages that you can install. In fact, as of the current date of 4/29/2022, it has 9102 packages that you can install.

Here are some examples of packages you can install:

Python, Git, Chrome, Firefox, Adobe Reader, Java SE Runtime Environment or JRE8, Notepad++, VLC, 7zip, Krita, Greenshot, OBS, Go (Golang), Sourcetree, among others.

Chocolatey GUI

As a final topic, I’ll mention that this Package Manager has a GUI, making it easier to install different packages or programs.

To install it, you need to run the Power Shell console as an administrator and run the following command:

Power Shell[Administrator]
choco install chocolateygui
Chocolatey v1.1.0
Installing the following packages:
chocolateygui
By installing, you accept licenses for the packages.
Progress: Downloading ChocolateyGUI 1.0.0... 100%
Progress: Downloading chocolatey-core.extension 1.4.0... 100%
Progress: Downloading chocolatey-compatibility.extension 1.0.0... 100%
Progress: Downloading dotnetfx 4.8.0.20190930... 100%
Progress: Downloading chocolatey-dotnetfx.extension 1.0.1... 100%
Progress: Downloading KB2919355 1.0.20160915... 100%
Progress: Downloading KB2919442 1.0.20160915... 100%

chocolatey-compatibility.extension v1.0.0 [Approved]
chocolatey-compatibility.extension package files install completed. Performing other installation steps.
 Installed/updated chocolatey-compatibility extensions.
 The install of chocolatey-compatibility.extension was successful.
  Software installed to 'C:\ProgramData\chocolatey\extensions\chocolatey-compatibility'

chocolatey-core.extension v1.4.0 [Approved]
chocolatey-core.extension package files install completed. Performing other installation steps.
 Installed/updated chocolatey-core extensions.
 The install of chocolatey-core.extension was successful.
  Software installed to 'C:\ProgramData\chocolatey\extensions\chocolatey-core'

chocolatey-dotnetfx.extension v1.0.1 [Approved]
chocolatey-dotnetfx.extension package files install completed. Performing other installation steps.
 Installed/updated chocolatey-dotnetfx extensions.
 The install of chocolatey-dotnetfx.extension was successful.
  Software installed to 'C:\ProgramData\chocolatey\extensions\chocolatey-dotnetfx'

KB2919442 v1.0.20160915 [Approved]
kb2919442 package files install completed. Performing other installation steps.
The package KB2919442 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): y

Skipping installation because this hotfix only applies to Windows 8.1 and Windows Server 2012 R2.
 The install of kb2919442 was successful.
  Software install location not explicitly set, it could be in package or
  default install location of installer.

KB2919355 v1.0.20160915 [Approved]
kb2919355 package files install completed. Performing other installation steps.
The package KB2919355 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): y

Skipping installation because this hotfix only applies to Windows 8.1 and Windows Server 2012 R2.
 The install of kb2919355 was successful.
  Software install location not explicitly set, it could be in package or
  default install location of installer.

dotnetfx v4.8.0.20190930 [Approved]
dotnetfx package files install completed. Performing other installation steps.
The package dotnetfx 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): y

Microsoft .NET Framework 4.8 or later is already installed.
 The install of dotnetfx was successful.
  Software install location not explicitly set, it could be in package or
  default install location of installer.

ChocolateyGUI v1.0.0 [Approved]
chocolateygui package files install completed. Performing other installation steps.
The package ChocolateyGUI 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): y

Installing ChocolateyGUI...
ChocolateyGUI has been installed.
Added C:\ProgramData\chocolatey\bin\chocolateygui.exe shim pointed to 'c:\program files (x86)\chocolatey gui\chocolateygui.exe'.
Added C:\ProgramData\chocolatey\bin\chocolateyguicli.exe shim pointed to 'c:\program files (x86)\chocolatey gui\chocolateyguicli.exe'.
  chocolateygui may be able to be automatically uninstalled.
 The install of chocolateygui was successful.
  Software installed as 'msi', install location is likely default.

Chocolatey installed 7/7 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Installed:
 - kb2919355 v1.0.20160915
 - chocolatey-core.extension v1.4.0
 - dotnetfx v4.8.0.20190930
 - kb2919442 v1.0.20160915
 - chocolateygui v1.0.0
 - chocolatey-compatibility.extension v1.0.0
 - chocolatey-dotnetfx.extension v1.0.1
Category: en-others
Something wrong? If you found an error or mistake in the content you can contact me on Twitter | @luisg2249_luis.
Last 4 post in same category

Comments