吐血推薦Windows上的包管理軟件chocolatey

Ubuntu上安裝軟件是apt-get install xxx,

Mac一般都推薦裝個brew之後,brew install xxx,

那麼來到Windows的時間就開始抓狂了,找下載鏈接下載exe,然後exe安裝完了之後有些東西還要配置什麼鬼環境變量(不用問我是撒了)。

問題來了,難道Windows沒有好用的軟件包管理工具呢?

(360軟件管家、騰訊軟件管家蠢蠢欲動...死變態,一邊去!!!)

答案是:有,請認準Chocolatey - The package manager for Windows

怎麼玩?如下:

Install with cmd.exe

Run the following command: (copy command text)

@"%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 with PowerShell.exe

With PowerShell, there is an additional step. You must ensure Get-ExecutionPolicy is not Restricted. We suggest using Bypass to bypass the policy to get things installed or AllSigned for quite a bit more security.

  • Run Get-ExecutionPolicy. If it returns Restricted, then run Set-ExecutionPolicy AllSigned or Set-ExecutionPolicy Bypass -Scope Process.
  • Now run the following command: (copy command text)
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

 

根據網絡情況可能需要一分鐘到幾分鐘不等,如果遇到超時失敗之類的,重試一下,再不行自行翻越長城。

 

需要JDK?

C:\> choco install jdk8

 

需要JDK9?

C:\> choco install jdk9

 

需要最新版Chrome?

C:\> choco install googlechrome

 

需要IDEA?

C:\> choco install intellijidea-community

 

需要Git?

C:\> choco install git

 

需要什麼軟件包可以再這裏Chocolatey Gallery | Packages搜索一下,美滋滋的。

什麼,install完了還需要配置什麼環境變量麼?

肯定是直接洗洗睡啊。

 

chocolatey是windows下的一個命令行的包管理工具,類似ubuntu的apt,或centos下的yum。

準備

在安裝之前,你先要將你的powershell設置爲允許執行遠程腳本:

  • Running as administrator來打開PowerShell
  • 命令行裏輸入Set-ExecutionPolicy RemoteSigned

安裝choco

詳細請查閱官方文檔,我是直接使用了最簡單的PowerShell v3+ 的安裝方式:

iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex

PowerShell輸入上面這代碼然後enter。

裝好了,然後呢?

然後你就能像ubuntu下apt-get那樣安裝你所需要的軟件/包了,例如你想裝個chrome:

choco install googlechrome

或者來個winrar:

choco install winrar

再來個nodejs?

choco install nodejs.install

更多可安裝的包可以查看這個網址:https://chocolatey.org/packages

 

參考文獻:

https://chocolatey.org/

https://www.jianshu.com/p/be19a2bebc48

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章