Scoop的安装与配置
Scoop 是我个人比较喜欢的 Windows 包管理器。但默认依赖 GitHub,国内网络环境下安装慢、易报错。本文将指导从安装、换源到加速全流程。
前置准备
PowerShell 默认禁止运行本地脚本,需解锁:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUserPowerShell 的安装与美化请参考美化Windows Terminal,推荐通过 Scoop 安装:
scoop install powershell安装 Scoop
推荐南大镜像一键安装:
irm https://mirror.ghproxy.com/https://raw.githubusercontent.com/duzyn/scoop-cn/master/install.ps1 | iex若出现 SSL 报错,改用跳过证书校验的方式:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
add-type -TypeDefinition @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
System.Net.ServicePointManager::CertificatePolicy = New-Object TrustAllCertsPolicy
irm https://ghproxy.cc/https://raw.githubusercontent.com/duzyn/scoop-cn/master/install.ps1 | iex验证安装:
scoop --version换源:国内镜像 + 实用仓库
删除默认国外源
scoop bucket rm main
scoop bucket rm extras
scoop bucket rm versions添加南大镜像源
main / extras / versions / nirsoft 走南大镜像,git 拉取稳定快速:
scoop bucket add main https://mirror.nju.edu.cn/git/scoop-main.git
scoop bucket add extras https://mirror.nju.edu.cn/git/scoop-extras.git
scoop bucket add versions https://mirror.nju.edu.cn/git/scoop-versions.git
scoop bucket add nirsoft https://mirror.nju.edu.cn/git/scoop-nirsoft.git/添加 GitHub 官方仓库(代理前缀加速)
games / sysinternals 等官方仓库统一走 GitHub,通过代理前缀加速拉取:
scoop bucket add games https://gh-proxy.com/https://github.com/Calinou/scoop-games
scoop bucket add sysinternals https://gh-proxy.com/https://github.com/niheaven/scoop-sysinternals添加中文仓库
推荐 Dorado(纯净无捆绑):
scoop bucket add dorado https://gh-proxy.com/https://github.com/chawyehsu/dorado.git备选 ScoopCN:
scoop bucket add scoopcn https://gh-proxy.com/https://github.com/scoopcn/scoopcn.git已添加的 GitHub bucket 无需重克隆,直接切换 git remote 即可(也可用下文脚本的菜单批量处理):
git -C "$env:SCOOP\buckets\games" remote set-url origin "https://gh-proxy.com/https://github.com/Calinou/scoop-games"加速优化
开启 Aria2 多线程下载
scoop uninstall aria2 --purge
scoop cache rm aria2
scoop install https://mir.nju.edu.cn/git/scoop-extras/raw/master/bucket/aria2.json
scoop config aria2-enabled true
scoop config aria2-retry-wait 2
scoop config aria2-split 5
scoop config aria2-max-connection-per-server 5
scoop config aria2-min-split-size 4MGitHub 下载加速
PowerShell 直接运行脚本,按菜单选择即可:
irm https://raw.githubusercontent.com/Dr1mH4X/Scripts/refs/heads/main/pwsh/scoop-proxy.ps1 | iexscoop update 自更新会覆盖 download.ps1 导致加速失效。将脚本保存到本地后,一条命令即可完成更新并重新启用加速(自动读取已配置的 GITHUB_PROXY):
.\scoop-proxy.ps1 -Update如需切换加速链接,追加 -Proxy 参数:
.\scoop-proxy.ps1 -Update -Proxy ghfast.top交互模式下直接运行脚本选择菜单 6,效果相同。
刷新并验证
scoop update
scoop bucket list恢复 SSL 验证
System.Net.ServicePointManager::CertificatePolicy = $null安装 scoop-search(搜索加速)
scoop search 默认查询 GitHub API,通常需要 20 秒以上。scoop-search 是本地的暴力替代品,通过索引本地清单实现毫秒级响应,平均快约 350 倍。
scoop install scoop-search安装 UniGetUI(图形界面)
UniGetUI 是 Scoop、Winget、Chocolatey 等命令行包管理器的图形前端,浏览、安装、更新、卸载软件全在一个窗口完成,无需记忆命令。
scoop install unigetui安装后在开始菜单找到 UniGetUI 启动即可。它自动识别已配置的 Scoop 源,所有通过 Scoop 安装的软件都会显示在界面中。
日常使用命令
| 操作 | 命令 |
|---|---|
| 搜索软件 | scoop-search <name> |
| 安装软件 | scoop install <name> |
| 卸载软件 | scoop uninstall <name> |
| 更新单个软件 | scoop update <name> |
| 更新所有 | scoop update * |
| 列出已安装 | scoop list |
| 清理旧版 | scoop cleanup * |
| 清理缓存 | scoop cache rm * |