chocolatey 安装_如何为Windows安装和使用Chocolatey Package Manager?

chocolatey 安装

chocolatey 安装

Linux distributions have different package managers like apt, yum, dnf in order to install applications, programs, packages. Windows recently has a package manager named Chocolatey which can search, install, remove Windows packages from a decentralized repository. It uses the NuGet infrastructure using PowerShell.

Linux发行版具有不同的软件包管理器,如apt,yum,dnf,以便安装应用程序,程序,软件包。 Windows最近有一个名为Chocolatey的程序包管理器,可以从分散的存储库中搜索,安装或删除Windows程序包。 它使用通过PowerShell使用的NuGet基础结构。

巧克力味 (Chocolatey Features)

Chocolatey provides advanced features like below.

Chocolatey提供了如下高级功能。

  • Chocolatey provides an unattended installation with a PowerShell.

    Chocolatey使用PowerShell提供了无人参与的安装。
  • Chocolatey works all existing software installation technologies like MSI, NSIS, InnoSeyup, etc.

    Chocolatey使用所有现有的软件安装技术,例如MSI,NSIS,InnoSeyup等。
  • Chocolatey can manage all aspects of software like search, install, update, remove.

    Chocolatey可以管理软件的所有方面,例如搜索,安装,更新和删除。
  • With PowerShell, software management can be automated by supporting complex scenarios.

    使用PowerShell,可以通过支持复杂方案来实现软件管理的自动化。
  • Easily build software installation packages.

    轻松构建软件安装包。
  • With Packet Internalizer makes offline package installation.

    使用Packet Internalizer可以进行脱机软件包安装。
  • Chocolatey integrates with configuration managers like SCCM, Puppet, Chef, or PowerShell DSC.

    Chocolatey与SCCM,Puppet,Chef或PowerShell DSC等配置管理器集成。
  • Create an internal organization repository for application installation.

    创建用于组织应用程序安装的内部组织存储库。
  • Provides CLI tool named, choco.exe for command-line usage.

    提供名为choco.exe的CLI工具以供命令行使用。
  • Provide a GUI tool named Chocolatey GUI for human-friendly usage.

    提供一个名为Chocolatey GUI的GUI工具,以方便人类使用。

Chocolatey安装要求 (Chocolatey Installation Requirements)

Chocolatey can be used with PowerShell and .Net Framework there is the following requirements in order to use Chocolatey.

Chocolatey可以与PowerShell和.Net Framework一起使用,要使用Chocolatey,需要满足以下要求。

  • Windows 7+/Windows 2003+ (Server Core also, but not Windows Nano Server)

    Windows 7 + / Windows 2003+(也是服务器核心,但不是Windows Nano Server)
  • Windows PowerShell v2+ (not PowerShell Core aka PowerShell 6 yet)

    Windows PowerShell v2 +(还不是PowerShell Core aka PowerShell 6)
  • .NET Framework 4.x+

    .NET Framework 4.x以上

使用MS-DOS命令行在Windows上安装Chocolatey(Install Chocolatey On Windows with MS-DOS Command-line)

We can install Chocolatey from the MS-DOS command line. First, we will open the MS-DOS command line with Administrative privileges below. Click open Start Menu and write cmd which will list Command Prompt. Right-click to the Command prompt which will open a menu which contains Run as administrator like below and click to open it.

我们可以从MS-DOS命令行安装Chocolatey 。 首先,我们将在下面使用管理权限打开MS-DOS命令行。 单击打开的Start Menu然后输入cmd ,其中将列出Command Prompt 。 右键单击“命令”提示符,将打开一个菜单,其中包含如下所示的Run as administrator ,然后单击以将其打开。

Start MS-DOS
启动MS-DOS

Then there will be a User Account Control. We will click to Yes

然后将有一个用户帐户控件。 我们将单击“ Yes

User Account Control
User Account Control
用户帐号控制

We will use the following command which is a bit complex but do not worry it will work seamlessly.

我们将使用以下命令,该命令有点复杂,但是请不要担心它将无缝运行。

> @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
Install Chocolatey On Windows with MS-DOS Command-line
Install Chocolatey On Windows with MS-DOS Command-line
在Windows上使用MS-DOS命令行安装Chocolatey

使用PowerShell命令行在Windows上安装Chocolatey (Install Chocolatey On Windows with PowerShell Command-line)

We can install Chocolatey from the PowerShell command line. First, we will open the PowerShell command line with Administrative privileges below. Click open Start Menu and write cmd which will list Command Prompt. Right-click to the Command prompt which will open a menu which contains Run as administrator like below and click to open it.

我们可以从PowerShell命令行安装Chocolatey 。 首先,我们将在下面使用管理权限打开PowerShell命令行。 单击打开的开始菜单,然后输入cmd,其中将列出命令提示符。 右键单击“命令”提示符,将打开一个菜单,其中包含如下所示的Run as administrator ,然后单击以将其打开。

Open MS-DOS
打开MS-DOS

Then there will be a User Account Control. We will click to Yes

然后将有一个用户帐户控件。 我们将单击“ Yes

We will use the following command which is a bit complex but does not worry it will work seamlessly. Then we will enable the unsigned PowerShell scripts to run on PowerShell. We will use Set-ExecutionPolicy. There will be a prompt where we will accept with A.

我们将使用以下命令,该命令有点复杂,但是请不要担心它将无缝运行。 然后,我们将使未签名的PowerShell脚本能够在PowerShell上运行。 我们将使用Set-ExecutionPolicy 。 我们将接受A的提示。

PS>  Set-ExecutionPolicy AllSigned

Now we can run the PowerShell installation script like below.

现在,我们可以运行如下所示的PowerShell安装脚本。

PS> Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

打印朱古力版 (Print Chocolatey Version)

After installing the Chocolatey we will print the version we have installed. We will use -v option which will print only the version of choco.exe.

安装Chocolatey之后,我们将打印已安装的版本。 我们将使用-v选项,该选项将仅打印choco.exe的版本。

PS> choco.exe -v
Print Chocolatey Version
Print Chocolatey Version
打印朱古力版

打印Chocolatey帮助信息(Print Chocolatey Help Information)

We can print help information about the choco.exe with the -h option. This will simply print general commands and detailed usage information about the choco.exe.

我们可以使用-h选项打印有关choco.exe帮助信息。 这将仅打印有关choco.exe常规命令和详细的使用信息。

PS> choco.exe -h
Print Chocolatey Help Information
Print Chocolatey Help Information
打印Chocolatey帮助信息

用Chocolatey搜索软件包,程序(Search Packages, Programs with Chocolatey)

We will start with a searching specific package with the search command. In this example, we will search for the package named winamp.

我们将从使用search命令搜索特定软件包开始。 在此示例中,我们将搜索名为winamp的软件包。

PS> choco.exe search winamp
Search Packages, Programs with Chocolatey
Search Packages, Programs with Chocolatey
用Chocolatey搜索软件包,程序

We can see that related packages are listed with the following information. We can see that there are 9 results which matched with the term winamp.

我们可以看到相关软件包列出了以下信息。 我们可以看到有9个结果与术语winamp相匹配。

  • package name is the exact name of the package like winamp.

    package namepackage name的确切名称,例如winamp

  • version is the latest package version which is 5.666.

    version是最新的软件包版本5.666

  • package status is the state of the package whether it is approved or not.

    package statuspackage status的状态,无论是否已批准。

LEARN MORE  How To Install Updates In Ubuntu, Debian, Mint, Kali
了解更多如何在Ubuntu,Debian,Mint,Kali中安装更新

打印有关Chocolatey软件包,程序的信息(Print Information About Packages, Programs with Chocolatey)

Before installation or if we are curious we can list detailed information about a package. We will use infocommand by providing the exact name of the package which is winamp in this example.

在安装之前,或者如果我们好奇,我们可以列出有关软件包的详细信息。 在此示例中,我们将通过提供软件包的确切名称(即winamp来使用info命令。

PS> choco.exe info winamp
Print Information About Packages, Programs with Chocolatey
Print Information About Packages, Programs with Chocolatey
打印有关Chocolatey软件包,程序的信息

We can see that there is detailed information about the package like below.

我们可以看到有关该软件包的详细信息,如下所示。

  • Title is the official name of the package which is Winamp.

    Title是软件包的正式名称,即Winamp

  •  Published is the date the package last time published.

    Published是包上次Published的日期。

  • Package Testing Status is the package test result and status whether it is working properly.

    Package Testing Status是包装测试结果和状态(是否正常工作)。

  • Number of Download is the total download number.

    Number of Download是总下载数。

  • Downloads for this version is the download number for the listed version which is 3386.

    Downloads for this version的下载是列出的版本的下载号3386。

  • Package URL Chocolatey Package Source is the source of the package URL location.

    Package URL Chocolatey Package Source是软件包URL位置的源。

  • Package Checksum is the SHA512 package hash.

    Package Checksum是SHA512软件包的哈希值。

  • Tags are keywords describing the package like category.

    Tags是描述类包装的关键字。

  • Software site is the site of the publishing of the software.

    Software siteSoftware site发布的站点。

  • Software License

    Software License

  • Summary is very little description of the package.

    Summary是对软件包的很少描述。

  • Description is detailed information about the package.

    Description是有关包装的详细信息。

用Chocolatey安装软件包,程序 (Install Packages, Programs with Chocolatey)

We can install specific a package with the install command by providing the package name.

通过提供软件包名称,我们可以使用install命令安装特定的软件包。

PS> choco.exe install winamp
Install Packages, Programs with Chocolatey
Install Packages, Programs with Chocolatey
用Chocolatey安装软件包,程序

We can see that Winamp installation is completed successfully after following steps.

在执行以下步骤后,我们可以看到Winamp安装成功完成。

  • The license is accepted

    许可证被接受
  • Package is downloaded

    包已下载
  • Accept to run installation scripts

    接受运行安装脚本
  • Installation Result

    安装结果

使用Chocolatey安装多个软件包,程序(Install Multiple Packages, Programs with Chocolatey)

We can also install multiple packages or programs with a single install command by separating them with spaces. We will use install command in order to install nmap, notepadplusplus and winamp like below.

我们也可以使用一个安装命令来安装多个软件包或程序,方法是用空格分隔它们。 我们将使用install命令来安装nmap,notepadplusplus和winamp,如下所示。

PS> choco.exe install notepadplusplus nmap winamp
Install Multiple Packages, Programs with Chocolatey
Install Multiple Packages, Programs with Chocolatey
使用Chocolatey安装多个软件包,程序

用Chocolatey更新指定的程序包,程序(Update Specified Packages, Programs with Chocolatey)

We can update specific packages with the upgrade command. We will also specify the package named which is nmap in this case.

我们可以使用upgrade命令更新特定的软件包。 在这种情况下,我们还将指定名为nmap的软件包。

PS> choco.exe upgrade nmap
Update Specified Packages, Programs with Chocolatey
Update Specified Packages, Programs with Chocolatey
用Chocolatey更新指定的程序包,程序

用Chocolatey列出过期/旧包装(List Outdated/Old Packages with Chocolatey)

We can also list currently installed and outdated or old packages. We will use outdatedcommand like below.

我们还可以列出当前已安装和已过期或旧的软件包。 我们将使用如下所示的outdated命令。

PS> choco.exe outdated
List Outdated/Old Packages with Chocolatey
List Outdated/Old Packages with Chocolatey
用Chocolatey列出过期/旧包装

While listing outdated packages the following information is provided.

在列出过时的软件包时,将提供以下信息。

  • Package name

    Package name

  • Current version is the currently installed an outdated version.

    Current version是当前安装的过时版本。

  • Available Version is the updated version available.

    Available VersionAvailable Version的更新版本。

  • Pinned

    Pinned

用Chocolatey删除/卸载软件包,程序 (Remove/Uninstall Packages, Programs with Chocolatey)

We can remove or uninstall the specified package. We will use uninstall command like below. We will uninstall the package named uninstall.

我们可以删除或卸载指定的软件包。 我们将使用如下所示的uninstall命令。 我们将卸载名为uninstall的软件包。

PS> choco.exe uninstall winamp
Remove/Uninstall Packages, Programs with Chocolatey
Remove/Uninstall Packages, Programs with Chocolatey
用Chocolatey删除/卸载软件包,程序

自己更新/升级Chocolatey(Update/Upgrade Chocolatey Itself)

Chocolatey is updated regularly. We can update upgrade chocolatey with the following command.

Chocolatey会定期更新。 我们可以使用以下命令更新升级Chocolatey。

PS> choco.exe install chocolatey

在Windows上安装Chocolatey GUI (Install Chocolatey GUI onWindows)

Chocolatey GUI is provided with the choco.exe we will install it with the package named chocolateygui.

Chocolatey GUI随choco.exe一起提供,我们将使用名为chocolateygui的软件包进行安装。

PS> choco.exe install chocolateygui
Install Chocolatey GUI onWindows
Install Chocolatey GUI onWindows
在Windows上安装Chocolatey GUI

Chocolatey GUI (Chocolatey GUI)

We can open Chocolatey GUI from the Start menu like below.

我们可以从“开始”菜单中打开Chocolatey GUI,如下所示。

Open Chocolatey GUI
Open Chocolatey GUI
打开Chocolatey GUI

As this is a package manager to install packages we required Administrative privileges

由于这是安装软件包的软件包管理器,因此我们需要管理权限

We will see the following dashboard which will provide most of the command line functions like install, update, remove.

我们将看到以下仪表板,它将提供大多数命令行功能,例如安装,更新,删除。

Chocolatey GUI
Chocolatey GUI
Chocolatey GUI

翻译自: https://www.poftut.com/how-to-install-and-use-chocolatey-package-manager-for-windows/

chocolatey 安装

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值