scoop——強大的Windows命令行包管理工具


scoop——強大的Windows命令行包管理工具

  • 2020年3月1日調整文章邏輯順序,增加aria2 16線程下載。

在下載了一系列軟件管理專家后,我遇到了scoop這一個神級的軟件包管理工具,他會自動設置環境變量,也會管理程序依賴。再添加了倉庫之后,基本能滿足我的軟件安裝和管理需求。后期我也會學習一下官方的配置寫法,維護一下我需要的一些其他的軟件。詳情可參見官網githubgithub-wiki

初級玩法:安裝scoop用以管理Windows軟件

安裝前的准備

  • 用戶名不含中文字符
  • Windows 7 SP1+ / Windows Server 2008+
  • PowerShell 3+
  • .NET Framework 4.5+
    若Powershell或.NET Franmework版本過舊,更新后重啟即可。
    若不清楚版本號,可Win+R運行powershell,輸入以下命令獲取版本號。
1 $PSVersionTable.PSVersion.Major   #查看Powershell版本
2 $PSVersionTable.CLRVersion.Major  #查看.NET Framework版本

安裝scoop

1 Set-ExecutionPolicy RemoteSigned -scope CurrentUser
2 iwr -useb get.scoop.sh | iex

如果下載scoop的過程中斷,那么必須先刪除(C:\Users<user>\scoop)文件夾,再執行以上命令安裝。
下載完成后,輸入scoop出現如下幫助即安裝成功。

幫助文檔

 1 Usage: scoop <command> [<args>]
 2 
 3 Some useful commands are:
 4 
 5 alias       Manage scoop aliases
 6 bucket      Manage Scoop buckets
 7 cache       Show or clear the download cache
 8 checkup     Check for potential problems
 9 cleanup     Cleanup apps by removing old versions
10 config      Get or set configuration values
11 create      Create a custom app manifest
12 depends     List dependencies for an app
13 export      Exports (an importable) list of installed apps
14 help        Show help for a command
15 home        Opens the app homepage
16 info        Display information about an app
17 install     Install apps
18 list        List installed apps
19 prefix      Returns the path to the specified app
20 reset       Reset an app to resolve conflicts
21 search      Search available apps
22 status      Show status and check for new app versions
23 uninstall   Uninstall an app
24 update      Update apps, or Scoop itself
25 virustotal  Look for app's hash on virustotal.com
26 which       Locate a shim/executable (similar to 'which' on Linux)
27 
28 Type 'scoop help <command>' to get help for a specific command.

基本操作

查找軟件

在安裝軟件之前,推薦先查詢一下。比如我們查詢一下git:

1 scoop search git

main倉庫中找到如下軟件:

 1 'main' bucket:
 2     git-annex (7.20190129)
 3     git-crypt (0.6.0-701fb8e)
 4     git-istage (0.2.61)
 5     git-lfs (2.6.1)
 6     git-sizer (1.3.0)
 7     git-town (7.2.0)
 8     git-up (1.6.1)
 9     git-with-openssh (2.20.1.windows.1)
10     git (2.20.1.windows.1)
11     git19 (1.9.5-preview20150319)
12     gitignore (0.2018.08.04)
13     gitkube (0.3.0)
14     gitlab-runner (11.7.0)
15     gitversion (4.0.0)
16     mingit-busybox (2.20.1.windows.1)
17     mingit (2.20.1.windows.1)
18     psgithub (2017.01.22)
19     psutils (0.2018.08.04) --> includes 'gitignore.ps1'

安裝軟件

找到git的包名后,我們安裝它:

1 scoop install git

安裝成功:

 1 Installing 'git' (2.20.1.windows.1) [64bit]
 2 Loading PortableGit-2.20.1-64-bit.7z.exe from cache
 3 Checking hash of PortableGit-2.20.1-64-bit.7z.exe ... ok.
 4 Extracting dl.7z ... done.
 5 Linking ~\scoop\apps\git\current => ~\scoop\apps\git\2.20.1.windows.1
 6 Creating shim for 'git'.
 7 Creating shim for 'gitk'.
 8 Creating shim for 'git-gui'.
 9 Creating shim for 'tig'.
10 Creating shim for 'git-bash'.
11 Creating shortcut for Git Bash (git-bash.exe)
12 Running post-install script...
13 'git' (2.20.1.windows.1) was installed successfully!

安裝完成的軟件會放在C:\Users<user>\scoop\apps。

利用aria2加速下載

在使用scoop安裝aria2后,scoop會自動調用aria2進行多線程下載以加速下載:

1 scoop install aria2

下載完成后,記得打開16線程(aria2編譯版本默認最高線程為16,需要更高的請自行編譯):

1 scoop config aria2-max-connection-per-server 16
2 scoop config aria2-split 16
3 scoop config aria2-min-split-size 1M

卸載軟件

1 scoop uninstall 7zip

更新scoop及軟件

1 scoop update #更新scoop
2 scoop update 7zip #更新7zip
3 scoop * #更新全部

添加倉庫

scoop自帶的main bucket軟件過少,我們需要添加官方維護的extras bucket:

1 scoop bucket add extras

之后就可以安裝我們所需的軟件了,附我的安裝軟件清單:

1 scoop install calibre gimp inkscape latex zotero

第三方bucket

若在scoop search中找不到需要的軟件,可以上github上的第三方bucket查找一下。
比如安裝cajviewer,添加bucket:

1 scoop bucket add scoopbucket https://github.com/yuanying1199/scoopbucket

安裝cajviewer:

1 scoop install scoopbucket/cajviewerlite
 
作者:mornwind
鏈接:https://www.jianshu.com/p/50993df76b1c
來源:簡書
著作權歸作者所有。商業轉載請聯系作者獲得授權,非商業轉載請注明出處。
注:(非商業轉載,僅供學習交流)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM