守护线程守护线程11-14 11:44

Scoop window包管理工具

官网地址:https://scoop.sh

准备

  • 用户名不含中文字符* Windows 7 SP1+ / Windows Server 2008+* PowerShell 3+* .NET Framework 4.5+
    若Powershell或.NET Franmework版本过旧,更新后重启即可。
    若不清楚版本号,可Win+R运行powershell,输入以下命令获取版本号。

ps:没有代理可能很慢或失败。

$PSVersionTable.PSVersion.Major   #查看Powershell版本
$PSVersionTable.CLRVersion.Major  #查看.NET Framework版本

win10 查看后,完美支持,不用升级。

PS C:\Users\inke> $PSVersionTable.PSVersion.Major
5
PS C:\Users\inke> $PSVersionTable.CLRVersion.Major
4

可以自己查看 Framework CLR运行时的版本 和 Framework版本关系

image.png

安装

执行以下命令行:

# 先设置 PowerShell 允许执行未签名脚本
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
# 下载 Scoop 安装脚本进行安装
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')

执行结果如下:

PS C:\Users\inke> Set-ExecutionPolicy RemoteSigned -scope CurrentUser

执行策略更改
执行策略可帮助你防止执行不信任的脚本。更改执行策略可能会产生安全风险,如 https:/go.microsoft.com/fwlink/?LinkID=135170
中的 about_Execution_Policies 帮助主题所述。是否要更改执行策略?
[Y] 是(Y)  [A] 全是(A)  [N] 否(N)  [L] 全否(L)  [S] 暂停(S)  [?] 帮助 (默认值为“N”): y

PS C:\Users\inke> iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
Initializing...
Downloading scoop...

如果下载scoop的过程中断(代理直接用全局,PAC模式没有包含该URL),那么必须先删除(C:\Users<user>\scoop)文件夹,再执行以上命令安装。
下载完成后,输入scoop出现如下帮助即安装成功。

执行成功:

PS C:\Users\inke> iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
Initializing...
Downloading scoop...
Extracting...
Creating shim...
Downloading main bucket...
Extracting...
Adding ~\scoop\shims to your path.
'lastupdate' has been set to '2019-08-11T09:35:38.2537719+08:00'
Scoop was installed successfully!
Type 'scoop help' for instructions.

命令

search 搜索软件名
install 安装软件
update 更新软件
status 查看软件状态
uninstall 卸载软件
info 查看软件详情
home 打开软件主页

安装 git

PS C:\Users\inke> scoop search git
'main' bucket:
    git-annex (7.20190709)
    git-chglog (0.8.0)
    git-crypt (0.6.0-701fb8e)
    git-interactive-rebase-tool (1.0.0)
    git-istage (0.2.61)
    git-lfs (2.8.0)
    git-sizer (1.3.0)
    git-tfs (0.30)
    git-town (7.2.1)
    git-up (1.6.1)
    git-with-openssh (2.22.0.windows.1)
    git (2.22.0.windows.1)
    git19 (1.9.5-preview20150319)
    gitignore (0.2018.07.25)
    gitkube (0.3.0)
    gitlab-runner (12.1.0)
    gitomatic (0.2)
    gitversion (5.0.0)
    llvm (8.0.1) --> includes 'git-clang-format'
    mingit-busybox (2.22.0.windows.1)
    mingit (2.22.0.windows.1)
    psgithub (2017.01.22)
    psutils (0.2018.08.04) --> includes 'gitignore.ps1'
PS C:\Users\inke> scoop install git
Installing '7zip' (19.00) [64bit]
7z1900-x64.msi (1.7 MB) [=====================================================================================] 100%
Checking hash of 7z1900-x64.msi ... ok.
Extracting 7z1900-x64.msi ... done.
Linking ~\scoop\apps\7zip\current => ~\scoop\apps\7zip\19.00
Creating shim for '7z'.
Creating shortcut for 7-Zip (7zFM.exe)
'7zip' (19.00) was installed successfully!
Installing 'git' (2.22.0.windows.1) [64bit]
PortableGit-2.22.0-64-bit.7z.exe (41.1 MB) [==================================================================] 100%
Checking hash of PortableGit-2.22.0-64-bit.7z.exe ... ok.
Extracting dl.7z ... done.
Linking ~\scoop\apps\git\current => ~\scoop\apps\git\2.22.0.windows.1
Creating shim for 'git'.
Creating shim for 'gitk'.
Creating shim for 'git-gui'.
Creating shim for 'tig'.
Creating shim for 'git-bash'.
Creating shortcut for Git Bash (git-bash.exe)
Running post-install script...
'git' (2.22.0.windows.1) was installed successfully!
Notes
-----
To get Git to recognise OpenSSH, you will need to run

scoop install openssh
[environment]::setenvironmentvariable('GIT_SSH', (resolve-path (scoop which ssh)), 'USER')

and then restart powershell.

添加一个 bucket

Scoop 给我们提供了很多可以直接使用的 bucket,常见,也是我推荐大家添加的 bucket 是 extras,

scoop bucket add extras

官方维护的 bucket

extras 这个 bucket 是最有用,也是我们大部分人肯定会用到的仓库。除此之外,我们可以通过这个命令查看 Scoop 还能直接识别哪些 bucket:

scoop bucket known

下面列出的这几个仓库就是 Scoop 可以直接识别并添加的 bucket,即我们可以通过下面这个命令直接添加相应的 bucket:

C:\Users\inke>scoop bucket known
main
extras
versions
nightlies
nirsoft
php
nerd-fonts
nonportable
java
games
jetbrains

例如:添加java

PS C:\Users\inke> scoop search jdk
Results from other known buckets...
(add them using 'scoop bucket add <name>')

'java' bucket:
    bucket/adoptopenjdk-hotspot-jre
    bucket/adoptopenjdk-hotspot
    bucket/adoptopenjdk-lts-hotspot-jre
    bucket/adoptopenjdk-lts-hotspot
    bucket/adoptopenjdk-lts-openj9-jre
    bucket/adoptopenjdk-lts-openj9
    bucket/adoptopenjdk-openj9-jre
    bucket/adoptopenjdk-openj9
    bucket/adoptopenjdk-upstream
    bucket/ojdkbuild-full
    bucket/ojdkbuild
    bucket/ojdkbuild10-full
    bucket/ojdkbuild10
    bucket/ojdkbuild11-full
    bucket/ojdkbuild11
    bucket/ojdkbuild12-full
    bucket/ojdkbuild12                                                                                                        bucket/ojdkbuild8-full                                                                                                    bucket/ojdkbuild8                                                                                                         bucket/ojdkbuild9-full                                                                                                    bucket/ojdkbuild9                                                                                                         bucket/openjdk                                                                                                            bucket/openjdk10
    bucket/openjdk11
    bucket/openjdk12
    bucket/openjdk13
    bucket/openjdk14
    bucket/openjdk7-unofficial
    bucket/openjdk9
    bucket/oraclejdk
    bucket/oraclejdk12

PS C:\Users\inke> scoop bucket add java
Checking repo... ok
The java bucket was added successfully.

PS C:\Users\inke> scoop install ojdkbuild8
Installing 'ojdkbuild8' (1.8.0.212-1.b04) [64bit]
java-1.8.0-openjdk-1.8.0.212-1.b04.ojdkbuild.windows.x86_64.zip (103.6 MB) [====================================] 100%
Checking hash of java-1.8.0-openjdk-1.8.0.212-1.b04.ojdkbuild.windows.x86_64.zip ... ok.
Extracting java-1.8.0-openjdk-1.8.0.212-1.b04.ojdkbuild.windows.x86_64.zip ... done.
Linking ~\scoop\apps\ojdkbuild8\current => ~\scoop\apps\ojdkbuild8\1.8.0.212-1.b04
'ojdkbuild8' (1.8.0.212-1.b04) was installed successfully!

PS C:\Users\inke> java -version
openjdk version "1.8.0_212-1-ojdkbuild"
OpenJDK Runtime Environment (build 1.8.0_212-1-ojdkbuild-b04)
OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)

社区提供的 bucket

上面几个 bucket 都是 Scoop 官方维护认证的 bucket,当然我们也有很多由社区(用户)维护的 bucket。这里是一个按照 Github score(由 Star 数量、Fork 数量和 App 数量综合决定的 Github score)排列的 bucket 列表:Scoop buckets by Github score

image.png

进阶用法

https://jszbug.com/7gtwknbs.html

参考:

https://jszbug.com/7gtwknbs.html

官场书屋二维码

小额赞赏

000
评论