Blog de programación, errores, soluciones

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

Chocolatey un Package Manager para Windows

Hoy veremos Chocolatey, un package manager para Windows que puede simplificar bastante las tareas de: instalar programas, actualizar programas, desinstalar programas, buscar programas, chequear que programas tenemos instalados.

Es probable que muchas veces te toparas con comandos como choco install <nombre> si estás en lo que es la programación, por otro lado, aunque no estés en el mundo de la programación, también te puede servir este package manger debido a que si instalamos programas de la manera tradicional siempre nos quedan restos de instaladores en nuestra carpeta de descargas.

Por último, y no menos importante, tenga en cuenta que cuando estamos instalando paquetes pueden que estos dependan de otros, Chocolatey instalaran estos por nosotros.

Instalación

Para poder instalar Chocolatey, tendrás que chequear que Get-ExecutionPolicy no está restringido. Puedes hacer esto entrando a tu power shell como admin y poner el siguiente código

Power Shell
Get-ExecutionPolicy
Restricted

En caso de que el resultado de correr el comando y su resultado sea Restricted deberás ejecutar el siguiente comando para que ya no esté restringido.

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"):

La respuesta a esto deberá ser s y ya nos debería quedar sin restricciones.

Ahora instalaremos 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

Ahora que tenemos instalado podemos chequear si está instalado en nuestra consola CMD con el simple comando choco -?, este nos dará la versión y diferentes flags que podemos usar con Chocolatey.

choco -?

Que puedo instalar con Chocolatey

Este package mange te ofrece un amplio repertorio que puedes instalar, de echo a la fecha actual 29/4/2022 tiene 9102 packetes que puedes instalar.

Algunos que puedes instalar:

Python, Git, Chrome, Firefox, adobe reader, Java SE runtime environment o jre8, notepad++, VLC, 7zip, krita, greenshot, obs, go(golang), sourcetree, otros.

Chocolatey GUI

Como ultimo tema dejo que este Package Manager posee una gui facilitandonos las instalacion de diferentes paquetes o programas.

Para instalarla deberás correr la consola Power Shell como administrador y correr el siguiente comando

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: otros
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