lvxianchao / notes

狗屁不通瞎写的博客
https://coderlxc.com
1 stars 0 forks source link

Windows 10 使用 Scoop 包管理器 #22

Open lvxianchao opened 2 years ago

lvxianchao commented 2 years ago

1、安装

打开 Windows PowerShell 输入以下命令:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

遇到以下选择项选择 A

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A

继续执行 irm get.scoop.sh | iex 得到以下:

Initializing...
Downloading...
Extracting...
Creating shim...
Adding ~\scoop\shims to your path.
Scoop was installed successfully!
Type 'scoop help' for instructions.

执行 scoop -v 查看版本:

Current Scoop version:
v0.2.3 - Released at 2022-07-07

2、设置镜仓库

使用 南京大学镜像 加速,提供有 mainextrasnonportableversions 4 个镜像仓库。

首先执行 scoop bucket rm main 来删除 main 仓库,不然执行以下命令时,会提示:

WARN  The 'main' bucket already exists. To add this bucket again, first remove it by running 'scoop bucket rm main'.

添加镜像源:

# main
scoop bucket add main https://mirror.nju.edu.cn/git/scoop-main.git/

# extras
scoop bucket add main https://mirror.nju.edu.cn/git/scoop-extras.git/

# nonportable
scoop bucket add main https://mirror.nju.edu.cn/git/scoop-nonportable.git/

# versions
scoop bucket add main https://mirror.nju.edu.cn/git/scoop-versions.git/

完成后执行 scoop update,这一步我本地处于报错状态,提示连接到 github.com 超时:

➜  ~ scoop update
Updating Scoop...
fatal: unable to access 'https://github.com/ScoopInstaller/Scoop/': Failed to connect to github.com port 443 after 21039 ms: Timed out
Update failed.

于是决定直接使用代理。

3、使用代理

scoop config proxy [username:password]host:port

执行 scoop update 会输出以下内容:

➜  ~ scoop update
Updating Scoop...
Updating 'extras' bucket...
Updating 'main' bucket...
Updating 'nonportable' bucket...
Updating 'versions' bucket...
Scoop was updated successfully!