Scoop安装和简单使用示例
Scoop安装使用
Windows下的软件安装工具。类似centos下的yum,乌班图下的apt。
官方的github地址是:https://github.com/lukesampson/scoop
安装必须条件
- Windows 7 SP1+ / Windows Server 2008+
- PowerShell 版本大于5 NET Framework 版本大于4.5(一般windows10电脑都满足)
安装
打开powershell,或者打开cmd输入:powershell进入
C:\Users\sundear>powershell
Windows PowerShell
版权所有 (C) Microsoft Corporation。保留所有权利。
尝试新的跨平台 PowerShell https://aka.ms/pscore6
设置scoop的安装目录不在C盘,我这里设置的是D盘
##设置d盘安装
PS C:\Users\sundear> $env:SCOOP='D:\Scoop'
##设置环境变量
PS C:\Users\sundear> [Environment]::SetEnvironmentVariable('SCOOP',$env:SCOOP,'User')
## 设置本地环境变量,依次执行执行下面两个命令
PS C:\Users\sundear> $env:SCOOP_GLOBAL='D:\ScoopGlobalApps'
PS C:\Users\sundear> [Environment]::SetEnvironmentVariable('SCOOP_GLOBAL',$env:SCOOP_GLOBAL,'User')
官方给的安装命令(我执行都是报错的)
## 报错
PS C:\Users\sundear> iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
使用“1”个参数调用“DownloadString”时发生异常:“未能解析此远程名称: 'raw.githubusercontent.com'”
所在位置 行:1 字符: 1
+ iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
## 报错
PS C:\Users\sundear> iwr-useb get.scoop.sh|iex
iwr-useb : 无法将“iwr-useb”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保
路径正确,然后再试一次。
所在位置 行:1 字符: 1
+ iwr-useb get.scoop.sh|iex
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (iwr-useb:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
修改下host文件,管理员打开
host文件路径: C:\Windows\System32\drivers\etc\hosts
最下面加一行:199.232.4.133 raw.githubusercontent.com
然后执行powershell窗口执行下面的安装命令:
iex (new-object net.webclient).downloadstring('https://raw.githubusercontent.com/lukesampson/scoop/master/bin/install.ps1')`
可能会出现下面的错误
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'
然后就按提示执行:Set-ExecutionPolicy RemoteSigned -scope CurrentUser
然后再次安装,安装成功如下所示
PS C:\Users\sundear> iex (new-object net.webclient).downloadstring('https://raw.githubusercontent.com/lukesampson/scoop/master/bin/install.ps1')
Initializing...
Downloading scoop...
Extracting...
Creating shim...
Downloading main bucket...
Extracting...
Adding D:\Scoop\shims to your path.
'lastupdate' has been set to '2021-09-17T15:46:12.6810571+08:00'
Scoop was installed successfully!
Type 'scoop help' for instructions.
官方的默认bucket(类似软件库的意思)是 main,可以查看官方的软件库库:
执行:scoop bucket known
PS C:\Users\sundear> scoop bucket known
main
extras
versions
nightlies
nirsoft
php
nerd-fonts
nonportable
java
games
jetbrains
执行:scoop bucket add extras
PS C:\Users\sundear> scoop bucket add extras
Checking repo... ok
fatal: unable to access 'https://github.com/lukesampson/scoop-extras/': OpenSSL SSL_read: Connection was reset, errno 10054
The extras bucket was added successfully.
然后就可以愉快的安装软件了。输入scoop有命令提示。
PS C:\Users\sundear> scoop
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)
可以通过:scoop search 软件名字
进行搜索。
PS C:\Users\sundear> scoop search git
'main' bucket:
git-annex (8.20210804)
git-chglog (0.15.0)
git-crypt (0.6.0-701fb8e)
git-filter-repo (2.33.0)
git-interactive-rebase-tool (2.1.0)
git-istage (0.3.33)
git-lfs (2.13.3)
git-sizer (1.4.0)
git-tfs (0.32.0)
git-town (7.5.0)
git-up (2.0.2)
git-with-openssh (2.33.0.windows.2)
git-xargs (0.0.11)
git (2.33.0.windows.2)
gitea (1.15.2)
gitignore (0.2018.07.25)
gitkube (0.3.0)
gitlab-runner (14.2.0)
gitomatic (0.2)
gitui (0.17.1)
gitversion (5.6.11)
legit (1.2.0)
mingit-busybox (2.33.0.windows.2)
mingit (2.33.0.windows.2)
psgithub (2017.01.22)
psutils (0.2020.02.27) --> includes 'gitignore.ps1'
安装软件直接执行install。
PS C:\Users\sundear> scoop install curl
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。