1. 安装 scoop
1.1 安装 PowerShell 5.0 以上版本
- win10: 已自带;
- win7 x64: 下载 Win7AndW2K8R2-KB3191566-x64.zip,安装;
1.2 以当前Win账户运行PowerShell
set-executionpolicy remotesigned -s cu
1.3.1 安装 scoop (从 github 安装)
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
这里安装时经常卡住,
是因为 https://get.scoop.sh 其实指向了 https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/bin/install.ps1
在 install.ps1 中大概 line 31 处又引用了 https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/lib/core.ps1因而导致安装失败。
1.3.2 安装 scoop (从本地安装)
以 fastgit 为例:
- 下载
install.ps1
curl -o scoop_install.ps1 https://hub.fastgit.xyz/ScoopInstaller/Scoop/blob/master/bin/install.ps1
- 修改
scoop_install.ps1
内容:
# line 31 左右,
# # get core functions
# $core_url = 'https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/lib/core.ps1'
$core_url = 'https://raw.fastgit.org/ScoopInstaller/Scoop/master/lib/core.ps1'
# line 43 左右,
# # download scoop zip
# $zipurl = 'https://github.com/ScoopInstaller/Scoop/archive/master.zip'
$zipurl = 'https://download.fastgit.org//ScoopInstaller/Scoop/archive/master.zip'
# line 58 左右,
# # download main bucket
$dir = "$scoopdir\buckets\main"
# $zipurl = 'https://github.com/ScoopInstaller/Main/archive/master.zip'
$zipurl = 'https://download.fastgit.org/ScoopInstaller/Main/archive/master.zip'
- 运行 scoop_install.ps1
.\scoop_install.ps1
2. 使用 github mirror 更新 Scoop、 bucket 库
以 gitee 为例
2.1 设置 Scoop 源
scoop config SCOOP_REPO 'https://gitee.com/shenbo1989/ScoopInstaller_Scoop'
2.2 设置 bucket 源
2.2.1 直接删除原有仓库, 添加新的
# scoop bucket rm main
scoop bucket add main 'https://gitee.com/shenbo1989/ScoopInstaller_Main'
# scoop bucket rm extras
scoop bucket add extras 'https://gitee.com/shenbo1989/ScoopInstaller_Extras'
# scoop bucket rm versions
scoop bucket add versions 'https://gitee.com/shenbo1989/ScoopInstaller_Versions'
- 2.2.2 直接修改仓库remot地址
cd ~\scoop\buckets\main
git remote set-url origin 'https://gitee.com/shenbo1989/ScoopInstaller_Main'
cd ~\scoop\buckets\extras
git remote set-url origin 'https://gitee.com/shenbo1989/ScoopInstaller_Extras'
cd ~\scoop\buckets\versions
git remote set-url origin 'https://gitee.com/shenbo1989/ScoopInstaller_Versions'
cd ~
2.3 安装常用软件
# main buckets
scoop install 7zip
scoop install git
scoop install aria2
scoop install concfg
scoop install oh-my-posh
scoop install ffmpeg
# extra buckets
scoop install everything
scoop install trafficmonitor
scoop install vscode
scoop install windows-terminal
# ===
# python
scoop install python39 # versions
scoop install pycharm # extra
# nodejs
scoop install nodejs # main
# latex
scoop install miktex # main
scoop install perl # main
scoop install texstudio # extra
3. 修改 scoop 安装文件源码, 加速软件源文件从 github 上的下载
- 修改
~\scoop\apps\scoop\current\lib\install.ps1
文件:
cd ~\scoop\apps\scoop\current\ | code lib\install.ps1
# line 265 左右,添加以下内容:
$urlstxt_content = $urlstxt_content.Replace('https://github.com', 'https://hub.fastgit.xyz')
$urlstxt_content = $urlstxt_content.Replace('https://raw.githubusercontent.com', 'https://raw.fastgit.org')
# $urlstxt_content = $urlstxt_content.Replace('https://github.com', 'https://ghproxy.com/https://github.com')
# $urlstxt_content = $urlstxt_content.Replace('https://raw.githubusercontent.com', 'https://ghproxy.com/https://raw.githubusercontent.com')
# $urlstxt_content = $urlstxt_content.Replace('https://ghproxy.com/https://ghproxy.com', 'https://ghproxy.com')
PS. 快捷命令
- 打开 powershell 配置文件:
code $PROFILE
加入以下命令
function scoop-sourcecode { cd ~\scoop\apps\scoop\current\ | code lib\install.ps1 }
function scoop-config-gitee {
scoop config SCOOP_REPO 'https://gitee.com/shenbo1989/ScoopInstaller_Scoop'
cd ~\scoop\buckets\main
git remote set-url origin 'https://gitee.com/shenbo1989/ScoopInstaller_Main'
cd ~\scoop\buckets\extras
git remote set-url origin 'https://gitee.com/shenbo1989/ScoopInstaller_Extras'
cd ~\scoop\buckets\versions
git remote set-url origin 'https://gitee.com/shenbo1989/ScoopInstaller_Versions'
cd ~
}
网友评论