windows 包管理工具 chocolatey

安装

chocolatey 类似于Node.js的npm,MacOS的brew,Ubuntu的apt-get,它简称为choco。官网: https://chocolatey.org/

windows 包管理工具 chocolatey_第1张图片
image.png

管理员身份打开cmd或cmder

λ @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Ne t.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trus t errors, you may need to do one or more of the following: (1) upgrade to .NET Framework 4.5+ and PowerShell v3, (2) specify internal Ch ocolatey package location (set $env:chocolateyDownloadUrl prior to install or host the package internally), (3) use the Download + Power Shell method of install. See https://chocolatey.org/install for all install options.
Getting latest version of the Chocolatey package for download.
Getting Chocolatey from https://chocolatey.org/api/v2/package/chocolatey/0.10.11.
Extracting C:\Users\xxx\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip to C:\Users\xxx\AppData\Local\Temp\chocolatey\c hocInstall...
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.
警告: Not setting tab completion: Profile file does not exist at
'C:\Users\xxx\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
软件下载到目录 C:\ProgramData\chocolatey
#choco install ruby -y
Chocolatey v0.10.11
Installing the following packages:
ruby
By installing you accept licenses for the packages.
Progress: Downloading chocolatey-core.extension 1.3.3... 100%
Progress: Downloading ruby 2.5.3.1... 100%

chocolatey-core.extension v1.3.3 [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'

ruby v2.5.3.1 [Approved]
ruby package files install completed. Performing other installation steps.
The package ruby 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/[N]o/[P]rint): Y

Ruby is going to be installed in 'C:\tools\ruby25'
Installing 64-bit ruby...
ruby has been installed.
  ruby can be automatically uninstalled.
Environment Vars (like PATH) have changed. Close/reopen your shell to
 see the changes (or in powershell/cmd.exe just type `refreshenv`).
 ShimGen has successfully created a shim for rubyinstaller-2.5.3-1-x86_x32.exe
 The install of ruby was successful.
  Software installed to 'C:\tools\ruby25\'

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

ruby下载到c:\tools下, 除了在命令行中搜索软件包,还可以直接在Chocolatey网站上搜索软件包,网址是https://chocolatey.org/packages/ 。细心的同学会发现在网站上有一些同名的软件包,不同之处在于一个后面有Install,另一个则没有。这两者的区别是:有Install的软件包在安装之后,会在控制面板的添加和删除程序中找到。

#choco -v
0.10.11
列出本地已安装的包 choco list --local-only
列出Windows系统已安装的软件,还能显示本地安装的其他软件 choco list -li
#choco list -li
Chocolatey v0.10.11
chocolatey 0.10.11
chocolatey-core.extension 1.3.3
ruby 2.5.3.1
3 packages installed.

7-Zip 18.05 (x64)|18.05
Adobe Flash Player 18 ActiveX|18.0.0.232
Adobe Reader XI - Chinese Simplified|11.0.00
Charles 4.2.7|4.2.7.4
Cisco Jabber|11.8.2.50390
FileZilla Client 3.35.1|3.35.1
Git version 2.18.0|2.18.0
升级所有已安装的包choco upgrade all -y
升级 choco upgrade chocolatey


使用

安装vlc ,安装到C:\Program Files\VideoLAN\VLC,奇怪的是直接进入目录找不到,需要复制地址进去。

choco install vlc
Chocolatey v0.10.11
Installing the following packages:
vlc
By installing you accept licenses for the packages.
Progress: Downloading vlc 3.0.4... 100%

vlc v3.0.4 [Approved]
vlc package files install completed. Performing other installation steps.
The package vlc 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/[N]o/[P]rint): Y

Installing x64 bit version
Installing vlc...
vlc has been installed.
vlc installed to 'C:\Program Files\VideoLAN\VLC'
vlc registered as vlc
  vlc may be able to be automatically uninstalled.
 The install of vlc was successful.
  Software installed to 'C:\Program Files\VideoLAN\VLC'

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

控制面板


windows 包管理工具 chocolatey_第2张图片
image.png

安装MongoDB
安装查找字符串工具rg
另外一管理工具scoop

公众号:苏生不惑


windows 包管理工具 chocolatey_第3张图片
扫描二维码关注

你可能感兴趣的:(windows 包管理工具 chocolatey)