Instalacion y Configuracion Chocolatey (Adminstrador de paquetes Windows)

Iniciado por R3v0lve, Enero 07, 2017, 11:59:41 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Hola undercoders , en el post hablare sobre un administrador de paquetes para windows similar ah de linux , es decir instalando paquetes por command lines en este caso usando el cmd o powershell el de su preferencia.

Requirements

    Windows 7+ / Windows Server 2003+
    PowerShell v2+
    .NET Framework 4+ (the installation will attempt to install .NET 4.0 if you do not have it installed)

¡Eso es! Todo lo que necesita es choco.exe (que se obtiene de los scripts de instalación) y usted es bueno para ir! No requiere Visual Studio

Installacion Con CMD
Nota ejecutar cmd como admin

Código: php
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"



Output del commando
Código: php
C:\Windows\system32>@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
Getting latest version of the Chocolatey package for download.
Getting Chocolatey from https://chocolatey.org/api/v2/package/chocolatey/0.10.3.
Downloading 7-Zip commandline tool prior to extraction.
Extracting C:\Users\ALOIS\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip to C:\Users\ALOIS\AppData\Local\Temp\chocolatey\chocInstall...
Installing chocolatey on this 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.
PATH environment variable does not have C:\ProgramData\chocolatey\bin in it. Adding...
Attempting to upgrade 'C:\Chocolatey' to 'C:\ProgramData\chocolatey'.
WARNING: Copying the contents of 'C:\Chocolatey' to 'C:\ProgramData\chocolatey'.
This step may fail if you have anything in this folder running or locked.
If it fails, just manually copy the rest of the items out and then delete the folder.
WARNING: !!!! ATTN: YOU WILL NEED TO CLOSE AND REOPEN YOUR SHELL !!!!
ADVERTENCIA: Not setting tab completion: Profile file does not exist at
'C:\Users\ALOIS\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.
WARNING: This action will result in Log Errors, you can safely ignore those.
You may need to finish removing 'C:\Chocolatey' manually.
Attempting to remove 'C:\Chocolatey'. This may fail if something in the folder is being used or locked.
Ensuring chocolatey commands are on the path
Ensuring chocolatey.nupkg is in the lib folder


En ese momento ya tenemos instalado el chocolatey .
Ahora les comentera el uso de el y configuracion hay otras formas de instalar chocolatey para powershell pero debes habilitar el (Ensure Get-ExecutionPolicy is not Restricted):  y como lamentablemente soy noob al uso de powershell es decir omito ese paso .

Ejecutamos

C:\Windows\system32>chocolatey
Chocolatey v0.10.3

como vemos el resultado es la version del chocolatey

Opciones de chocolatey
C:\Windows\system32>chocolatey /?
This is a listing of all of the different things you can pass to choco.

Commands

* list - lists remote or local packages
* 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
* source - view and configure default sources
* sources - view and configure default sources (alias for source)
* config - Retrieve and configure config file settings
* feature - view and configure choco features
* features - view and configure choco features (alias for feature)
* apikey - retrieves or saves an apikey for a particular source
* setapikey - retrieves or saves an apikey for a particular source (alias for apikey)
* unpackself - have chocolatey set it self 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.

How To Pass Options / Switches

You can pass options and switches in the following ways:

* Unless stated otherwise, an option/switch should only be passed one
   time. Otherwise you may find weird/non-supported behavior.
* `-`, `/`, or `--` (one character switches should not use `--`)
* **Option Bundling / Bundled Options**: One character switches can be
   bundled. e.g. `-d` (debug), `-f` (force), `-v` (verbose), and `-y`
   (confirm yes) can be bundled as `-dfvy`.
* NOTE: If `debug` or `verbose` are bundled with local options
   (not the global ones above), some logging may not show up until after
   the local options are parsed.
* **Use Equals**: You can also include or not include an equals sign
   `=` between options and values.
* **Quote Values**: When you need to quote an entire argument, such as
   when using spaces, please use a combination of double quotes and
   apostrophes (`"'value'"`). In cmd.exe you can just use double quotes
   (`"value"`) but in powershell.exe you should use backticks
   (`` `"value`" ``) or apostrophes (`'value'`). Using the combination
   allows for both shells to work without issue, except for when the next
   section applies.
* **Pass quotes in arguments**: When you need to pass quoted values to
   to something like a native installer, you are in for a world of fun. In
   cmd.exe you must pass it like this: `-ia "/yo=""Spaces spaces"""`. In
   PowerShell.exe, you must pass it like this: `-ia '/yo=""Spaces spaces""'`.
   No other combination will work. In PowerShell.exe if you are on version
   v3+, you can try `--%` before `-ia` to just pass the args through as is,
   which means it should not require any special workarounds.
* Options and switches apply to all items passed, so if you are
   installing multiple packages, and you use `--version=1.0.0`, choco
   is going to look for and try to install version 1.0.0 of every
   package passed. So please split out multiple package calls when
   wanting to pass specific options.

Default Options and Switches

-?, --help, -h
     Prints out the help menu.

-d, --debug
     Debug - Show debug messaging.

-v, --verbose
     Verbose - Show verbose messaging.

     --acceptlicense, --accept-license
     AcceptLicense - Accept license dialogs automatically. Reserved for
       future use.

-y, --yes, --confirm
     Confirm all prompts - Chooses affirmative answer instead of prompting.
       Implies --accept-license

-f, --force
     Force - force the behavior. Do not use force during normal operation -
       it subverts some of the smart behavior for commands.

     --noop, --whatif, --what-if
     NoOp / WhatIf - Don't actually do anything.

-r, --limitoutput, --limit-output
     LimitOutput - Limit the output to essential information

     --timeout, --execution-timeout=VALUE
     CommandExecutionTimeout (in seconds) - The time to allow a command to
       finish before timing out. Overrides the default execution timeout in the
       configuration of 2700 seconds.

-c, --cache, --cachelocation, --cache-location=VALUE
     CacheLocation - Location for download cache, defaults to %TEMP% or value
       in chocolatey.config file.

     --allowunofficial, --allow-unofficial, --allowunofficialbuild, --allow-unofficial-build
     AllowUnofficialBuild - When not using the official build you must set
       this flag for choco to continue.

     --failstderr, --failonstderr, --fail-on-stderr, --fail-on-standard-error, --fail-on-error-output
     FailOnStandardError - Fail on standard error output (stderr), typically
       received when running external commands during install providers. This
       overrides the feature failOnStandardError.

     --use-system-powershell
     UseSystemPowerShell - Execute PowerShell using an external process
       instead of the built-in PowerShell host. Should only be used when
       internal host is failing. Available in 0.9.10+.

Si analizamos el las opciones puedes , actualizar,eliminar,agregar,buscar los paquetes si eres un linuxero no veo que sea un problema para ti ya que la mayoria usamor la terminal , en windows nos puede ayudar ah no perder el tiempo

Los commandos utilizados son
Chocolatey install (paquetes asignado) //* sin plecas //*
Chocolatey uninstalll (paquetes asignado) //* sin plecas //*
Chocolatey search (paquetes asignado) //* sin plecas //*
Chocolatey list (Da lista completos de todos los paquetes)

Demostracion de search
Código: php
C:\Windows\system32>chocolatey search openoffice
Chocolatey v0.10.3
OpenOffice 4.1.3 [Approved] Downloads cached for licensed users
ExcelConverter 3.2.2
hunspell.portable 1.3.2.300
iecacheview 1.58 [Approved] Downloads cached for licensed users
pandoc 1.19.1.20161212 [Approved]
znotes 0.4.5 [Approved]
zotero-standalone 4.0.29.11 [Approved] Downloads cached for licensed users
7 packages found.


Demostracion de instalacion

Eligeremos el OpenOffice 4.1.3 [Approved] Downloads cached for licensed users

Output
Código: php

C:\Windows\system32>chocolatey install OpenOffice 4.1.3
Chocolatey v0.10.3
Installing the following packages:
OpenOffice;4.1.3
By installing you accept licenses for the packages.

OpenOffice v4.1.3 [Approved]
openoffice package files install completed. Performing other installation steps.
The package OpenOffice 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 setting
'allowGlobalConfirmation'. Run 'choco feature -h' for more details.
Do you want to run the script?([Y]es/[N]o/[P]rint): Y

Switching to es
Downloading OpenOffice
  from 'https://downloads.sourceforge.net/project/openofficeorg.mirror/4.1.3/binaries/es/Apache_OpenOffice_4.1.3_Win_x86_install_es.exe'
Progress: 27% - Saving 34.06 MB of 124.22 MB (35717120/130250784)


Y listo ya tenemos instalado solo esperar que termina de instlar el paquete mi internet es algo lento asi que no terminara

Saludos desde grupo de whatsapp ah
@Stef
@Dinno
@Victor
@Gabriela
Ми повинні мати віру в себе. У цьому і полягає секрет. Навіть коли я був у дитячому будинку і ходили по вулицях у пошуках їжі, щоб жити, навіть тоді, я вважав найбільшим актором в світі. Без абсолютної впевненості, один приречена на провал.