Scoop 軟件管理工具使用


簡介

scoop安裝

確保安裝 PowerShell 5(或更高版本,包括PowerShell 核心)和.NET 框架 4.5(或更高版本)。

查看powershell 版本

Get-Host | Select-Object Version

在 PowerShell 中輸入下面內容,保證允許本地腳本的執行:

set-executionpolicy remotesigned -scope currentuser

執行下面的命令安裝 Scoop:

Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')

或者

iwr -useb get.scoop.sh | iex

注意:如果遇到錯誤,則可能需要使用以下命令更改執行策略(即啟用Powershell)

Set-ExecutionPolicy RemoteSigned -scope CurrentUser

測試一下

scoop help

自定義安裝路徑

[environment]::setEnvironmentVariable('SCOOP','D:\Scoop','User')
$env:SCOOP='D:\Scoop'
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')

自定義路徑 D:

將全局應用安裝到自定義目錄

假設目標目錄是D:\Applications\Scoop\globalApps,在PowerShell命令控制台中運行:

[environment]::setEnvironmentVariable('SCOOP_GLOBAL','D:\Applications\Scoop\globalApps','Machine')
$env:SCOOP_GLOBAL='D:\Applications\Scoop\globalApps'

scoop 安裝失敗常見解決辦法

安裝中斷

可以使用代理重新連接,或者從Github下載源碼手動安裝

PowerShell的安全策略

報錯信息

PowerShell requires an execution policy in [Unrestricted, RemoteSigned, ByPass] to run Scoop.
For example, to set the execution policy to 'RemoteSigned' please run :
'Set-ExecutionPolicy RemoteSigned -scope CurrentUser'

解決:

修改PowerShell的安全策略,輸入y確認

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

無法連接到scoop 官網

使用“1”個參數調用“DownloadString”時發生異常:“無法連接到遠程服務器”
所在位置 行:1 字符: 1
+ iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WebException

切換命令安裝

iex (new-object net.webclient).downloadstring('https://raw.githubusercontent.com/lukesampson/scoop/master/bin/install.ps1')

如果不行,請使用vpn安裝或者指定相關端口

連接超時

iex : 使用“2”個參數調用“DownloadFile”是發生異常:“請求被中止: 未能創建 SSL/TLS 安全通道。”
所在位置 行:1 字符: 1
+ iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Invoke-Expression], MethodInvocationException
    + FullyQualifiedErrorId : WebException, Microsoft.PowreShell.Commands.InvokeExpressionCommand
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

安裝測試

scoop help
Usage: scoop <command> [<args>]

Some useful commands are:

alias       Manage scoop aliases
bucket      Manage Scoop buckets
cache       Show or clear the download cache
checkup     Check for potential problems
cleanup     Cleanup apps by removing old versions
config      Get or set configuration values
create      Create a custom app manifest
depends     List dependencies for an app
export      Exports (an importable) list of installed apps
help        Show help for a command
hold        Hold an app to disable updates
home        Opens the app homepage
info        Display information about an app
install     Install apps
list        List installed apps
prefix      Returns the path to the specified app
reset       Reset an app to resolve conflicts
search      Search available apps
status      Show status and check for new app versions
unhold      Unhold an app to enable updates
uninstall   Uninstall an app
update      Update apps, or Scoop itself
virustotal  Look for app's hash on virustotal.com
which       Locate a shim/executable (similar to 'which' on Linux)


Type 'scoop help <command>' to get help for a specific command.

scoop使用Aria2多線程下載

scoop install aria2

scoop 基本命令

命令 動作
search 搜索軟件名
install 安裝軟件
update 更新軟件
status 查看軟件狀態
uninstall 卸載軟件
info 查看軟件詳情
home 打開軟件主頁

通過下面的命令查看具體的命令的使用方式

scoop help [command]

常用命令:

  1. 列出已安裝的所有包

    scoop list
    
  2. Scoop 命令說明

    scoop help
    
  3. 獲取某個包的安裝信息

    scoop info python
    
  4. 打開某個包的官網

    scoop home python
    
  5. 禁止某個包更新

    scoop hold python
    

使用代理

用於一些下載較慢的情況。具體使用見官方Wiki

這里僅記錄使用當前用戶的網絡代理配置:

# 使用當前用戶的默認代理
scoop config proxy currentuser@default

# 移除代理
scoop config rm proxy

# 設置代理(http) 示例
scoop config proxy 127.0.0.1:4412

檢查問題

在安裝各種包時,或者進行了一些配置,可能會造成一些沖突或錯誤,這時可以使用scoop checkup來檢查問題,並按照其提示來解決。

而解決大部分問題的一個方案是重置

scoop reset *

它會重置所有的環境變量、快捷方式以解決沖突。

scoop 軟件管理

scoop help install
Usage: scoop install <app> [options]

e.g. The usual way to install an app (uses your local 'buckets'):
     scoop install git

To install an app from a manifest at a URL:
     scoop install https://raw.githubusercontent.com/ScoopInstaller/Main/master/bucket/runat.json

To install an app from a manifest on your computer
     scoop install \path\to\app.json

Options:
  -g, --global              Install the app globally
  -i, --independent         Don't install dependencies automatically
  -k, --no-cache            Don't use the download cache
  -s, --skip                Skip hash validation (use with caution!)
  -a, --arch <32bit|64bit>  Use the specified architecture, if the app supports it

示例

scoop search git
scoop install git
scoop uninstall git

全局安裝

scoop install oraclejdk8 -g;

軟件更新

scoop status
scoop update git
# 更新所有包
scoop update *
scoop update * --global
# 清除舊版本安裝信息
scoop cleanup *
scoop cleanup * --global

導出安裝軟件列表

scoop.cmd export > app_list.txt

更新所有安裝軟件

scoop update * && scoop cleanup *

使用Aria2多線程下載

scoop install aria2

如果用了aria2還是很慢,可以關閉它:

scoop config aria2-enabled false

scoop 軟件包管理

scoop help bucket
Usage: scoop bucket add|list|known|rm [<args>]

Add, list or remove buckets.

Buckets are repositories of apps available to install. Scoop comes with
a default bucket, but you can also add buckets that you or others have
published.

To add a bucket:
    scoop bucket add <name> [<repo>]

e.g.:
    scoop bucket add extras https://github.com/lukesampson/scoop-extras.git

Since the 'extras' bucket is known to Scoop, this can be shortened to:
    scoop bucket add extras

To list all known buckets, use:
    scoop bucket known

添加軟件包

由於 Scoop 的存儲桶本質上都是一個個 git 庫,所以想要添加額外的存儲庫,需要有 git 環境支撐,輸入 scoop install git 進行安裝即可。

輸入 scoop bucket known 就能查看官方已知的存儲桶列表

scoop bucket add <倉庫名>
"extras": "https://github.com/lukesampson/scoop-extras.git",
"versions": "https://github.com/scoopinstaller/versions",
"nightlies": "https://github.com/scoopinstaller/nightlies",
"nirsoft": "https://github.com/kodybrown/scoop-nirsoft",	
"php": "https://github.com/nueko/scoop-php.git",
"nerd-fonts": "https://github.com/matthewjberger/scoop-nerd-fonts.git",
"nonportable": "https://github.com/oltolm/scoop-nonportable",
"java": "https://github.com/se35710/scoop-java",
"games": "https://github.com/Calinou/scoop-games"

示例

scoop bucket add dorado https://github.com/h404bi/dorado
scoop install dorado/<AppName>

查看軟件包列表

scoop bucket list

我的軟件包列表

dorado
everyx
extras
games
GenericBucket-master
iszy
java
jetbrains
main
nerd-fonts
nightlies
nirsoft
nonportable
php
rasa
retools
scoopet
straywriter
sushi
Sysinternals
versions
wangzq
zapps

常用軟件包列表

known-application-buckets

scoop 卸載

卸載scoop

scoop 創建自己的軟件包

進階操作

自定義軟件包

應用清單

App Manifests

創建你自己的軟件包

creating-your-own-bucke

相關參考

scoop官網

scoop GitHub

scoop 文檔

少數派

scoop-config

Linnzh/Blog/issues/42

jszbug


免責聲明!

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



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