Total Pageviews

Friday, 11 February 2022

windows桌面系统上的包管理工具SCOOP

使用 scoop

scoop help                       # 查看帮助
scoop help <command>             # 查看具体某个命令的帮助

scoop search <app>               # 搜索软件包
scoop install <app>              # 安装软件包
scoop install git                # 安装 git
scoop install 7zip               # 安装 7zip
scoop uninstall <app>            # 卸载软件包

scoop search terminal
scoop bucket known               # 查看已知的软件库列表
scoop bucket add extras          # 添加软件库 extras
scoop install windows-terminal   # 安装 windows terminal

scoop install python@3.6.8       # 安装指定的版本
scoop hold python                # 禁止 Python 更新
scoop unhold python              # 允许 Python 更新

scoop status                     # 检查哪些软件包可以更新

scoop update                     # 更新 scoop
scoop update <app1> <app2>       # 更新软件包 qpp1 app2
scoop update *                   # 更新所有软件包

scoop list                       # 查看已经安装的软件包

scoop bucket add dorado https://github.com/h404bi/dorado    # 添加第三方软件库
scoop install dorado/<app>                                  # 从指定软件库中安装 app

scoop bucket list                # 查看添加的仓库列表
scoop bucket rm extras           # 移除软件库 extras

scoop cache                      # 查看软件包缓存
scoop cache rm <app>             # 删除某软件包的缓存
scoop cache rm *                 # 删除所有软件包的缓存

scoop cleanup <app>              # 删除某软件包的旧版本

scoop alias add <name> <command> <description>                       # 设置 scoop 别名
scoop alias add rm 'scoop uninstall $args[0]' 'Uninstall an app'     # 使用 scoop rm <app> 代替 scoop uninstall <app> 卸载软件包
scoop alias add upgrade 'scoop update *' 'Update all apps'           # 使用 scoop upgrade 代替 scoop update * 更新所有软件包

scoop alias list                 # 查看 scoop 别名
scoop alias list -v              # 查看 scoop 别名详情
scoop help                       # 可以查看到已经添加的别名
scoop alias rm rm                # 移除个刚刚添加的 rm 别名

scoop reset <app>@<version>      # 旧版本存在时,某 app 的多个版本之间切换
scoop reset <app>                # 某 app 切换到最新版本

scoop prefix git                 # 查看 git 安装路径
scoop info git                   # 查看 git 的安装信息
scoop home git                   # 用浏览器查看 git 的主页
scoop which git                  # 查看 git 命令的路径

scoop depends <app>              # 查看某软件包的依赖
scoop export > app.list          # 所有已经安装的软件包名,导出到 app.list 文件中

更新问题

# 大多数情况下,软件更新失败是因为国内 git pull 失败导致,可以尝试设置 git 代理解决

# 设置代理
git config --global http.proxy http://127.0.0.1:8118
git config --global https.proxy http://127.0.0.1:8118

# 查看代理设置
type ~/.gitconfig

# 取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy

--------------------------------------

from https://github.com/ScoopInstaller/Scoop

A command-line installer for Windows.
https://scoop.sh/

Scoop

Features | Installation | Documentation


Code Size Repository size Build Status Discord Chat Gitter Chat License

Scoop is a command-line installer for Windows.

What does Scoop do?

Scoop installs programs from the command line with a minimal amount of friction. It:

  • Eliminates permission popup windows
  • Hides GUI wizard-style installers
  • Prevents PATH pollution from installing lots of programs
  • Avoids unexpected side-effects from installing and uninstalling programs
  • Finds and installs dependencies automatically
  • Performs all the extra setup steps itself to get a working program

Scoop is very scriptable, so you can run repeatable setups to get your environment just the way you like, e.g.:

scoop install sudo
sudo scoop install 7zip git openssh --global
scoop install aria2 curl grep sed less touch
scoop install python ruby go perl

If you've built software that you'd like others to use, Scoop is an alternative to building an installer (e.g. MSI or InnoSetup) — you just need to zip your program and provide a JSON manifest that describes how to install it.

Requirements

  • Windows 7 SP1+ / Windows Server 2008+
  • PowerShell 5 (or later, include PowerShell Core) and .NET Framework 4.5 (or later)
  • PowerShell must be enabled for your user account e.g. Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Installation

Run the following command from your PowerShell to install scoop to its default location (C:\Users\<user>\scoop)

Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')

# or shorter
iwr -useb get.scoop.sh | iex

Once installed, run scoop help for instructions.

The default setup is configured so all user installed programs and Scoop itself live in C:\Users\<user>\scoop. Globally installed programs (--global) live in C:\ProgramData\scoop. These settings can be changed through environment variables.

Install Scoop to a Custom Directory by changing SCOOP

$env:SCOOP='D:\Applications\Scoop'
[Environment]::SetEnvironmentVariable('SCOOP', $env:SCOOP, 'User')
# run the installer

Configure Scoop to install global programs to a Custom Directory by changing SCOOP_GLOBAL

$env:SCOOP_GLOBAL='F:\GlobalScoopApps'
[Environment]::SetEnvironmentVariable('SCOOP_GLOBAL', $env:SCOOP_GLOBAL, 'Machine')
# run the installer

Configure Scoop to store downloads to a Custom Directory by changing SCOOP_CACHE

$env:SCOOP_CACHE='F:\ScoopCache'
[Environment]::SetEnvironmentVariable('SCOOP_CACHE', $env:SCOOP_CACHE, 'Machine')
# run the installer

Configure Scoop to use a GitHub API token during searching and checkver by setting SCOOP_CHECKVER_TOKEN

$env:SCOOP_CHECKVER_TOKEN='<paste-token-here>'
[Environment]::SetEnvironmentVariable('SCOOP_CHECKVER_TOKEN', $env:SCOOP_CHECKVER_TOKEN, 'Machine')
# search for an app

Documentation

Multi-connection downloads with aria2

Scoop can utilize aria2 to use multi-connection downloads. Simply install aria2 through Scoop and it will be used for all downloads afterward.

scoop install aria2

By default, scoop displays a warning when running scoop install or scoop update while aria2 is enabled. This warning can be suppressed by running scoop config aria2-warning-enabled false.

You can tweak the following aria2 settings with the scoop config command:

Inspiration

What sort of apps can Scoop install?

The apps that install best with Scoop are commonly called "portable" apps: i.e. compressed program files that run stand-alone when extracted and don't have side-effects like changing the registry or putting files outside the program directory.

Since installers are common, Scoop supports them too (and their uninstallers).

Scoop is also great at handling single-file programs and Powershell scripts. These don't even need to be compressed. See the runat package for an example: it's really just a GitHub gist.

Contribute to this project

If you'd like to improve Scoop by adding features or fixing bugs, please read our Contributing Guide.

Support this project

If you find Scoop useful and would like to support ongoing development and maintenance, here's how:

Known application buckets

The following buckets are known to scoop:

  • main - Default bucket for the most common (mostly CLI) apps
  • extras - Apps that don't fit the main bucket's criteria
  • games - Open source/freeware games and game-related tools
  • nerd-fonts - Nerd Fonts
  • nirsoft - Almost all of the 250+ apps from Nirsoft
  • java - A collection of Java development kits (JDKs), Java runtime engines (JREs), Java's virtual machine debugging tools and Java based runtime engines.
  • nonportable - Non-portable apps (may require UAC)
  • php - Installers for most versions of PHP
  • versions - Alternative versions of apps found in other buckets

The main bucket is installed by default. To add any of the other buckets, type:

scoop bucket add bucketname

For example, to add the extras bucket, type:

scoop bucket add extras

Other application buckets

Many other application buckets hosted on Github can be found in the Scoop Directory or via other search engines.

https://github.com/Ash258/Scoop-Core)

----------------------------------------------------


https://github.com/Ash258/Scoop-GithubActions

-----------------------------------------------------


https://github.com/kidonng/sushi/

https://github.com/kidonng/sushi/tree/master/bucket

https://github.com/kidonng/scoop-docs

https://github.com/kidonng/snoop

------------------------------------------------------

 

 

scoop —— 实用的 windows包管理软件

 windows 目前的软件生态想必大家都很清楚,各种常用开发软件(git chrome python vscode 等等)安装方式层出不穷,安装更新卸载流程繁琐耗时且效率低下,安装路径各异污染目录,且得不到统一的管理
他来了 – scoop

scoop 的出现,就是为了来解决上述问题的

简单地说,他将各种软件安装目录有序的堆放在一起,用户数据以及配置文件单独存放,更新时仅仅更新程序本身,极大的提高 windows 平台上管理软件的效率。
如何安装 scoop

请确保已经安装了:

    ① PowerShell 5 (或更高版本,包括 PowerShell Core)
    ② .net Framework 4.5 (或更高版本)。

    现在大部分机子都上了 win10,系统大都符合要求,可以直接进行下面的操作

在终端运行下列命令(建议在当前用户根目录(C:\Users\your_username)下)

# 运行这条命令
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')

# 或者这条更短的命令
iwr -useb get.scoop.sh | iex

然后你就可以在终端中输入 scoop 命令来查看是否安装完成

如果你遇到错误,你可能需要改变执行策略,运行下列命令来启用 powershell

Set-ExecutionPolicy RemoteSigned -scope CurrentUser

scoop 使用
添加 bucket

bucket 可以简单理解为软件清单

只有当前添加的 bucket 里有的软件才可以下载

通过下面的命令添加常用的 bucket 来扩大你可以安装的软件类别和数目

# 最常用的bucket
scoop bucket add extras
# 比较全的bucket
scoop bucket add extras
scoop bucket add dorado https://github.com/chawyehsu/dorado
scoop bucket add sushi https://github.com/kidonng/sushi
...

搜索软件

这条命令会在已经加入的 bucket 里搜寻合适的软件并打印出来

scoop search neteasemusic # 搜索网易云音乐

安装软件

scoop install APP_NAME

以下列出了常用的程序的安装命令

    必须先装 7zip,安装包的解压依靠它

# 推荐安装的常用程序(须先加extras的bucket)
scoop install 7zip git googlechrome vscode nodejs yarn postman everything sharex quicklook telegram
# 个人使用的软件(须先加extras、dorado和nonportable的bucket)
scoop install 7zip git googlechrome vscode yarn v2rayn sharex nodejs quicklook dismplusplus postman telegram oh-my-posh pscolor posh-git mactype-np neteasemusic everything mysql adb sudo nginx

卸载软件

scoop uninstall APP_NAME

更新软件

scoop update APP_NAME
# 一般都全部更新,用 * 通配符匹配所有
scoop update *

清理缓存(下载的安装包等)

scoop cache rm *

清理已安装软件残留的旧版本

更新程序后,旧版本的程序默认是保留的,可以手动清理

scoop cleanup *

切换版本

当安装的软件有多个版本,且都需要同时使用时,可以参考下面设置两个 nodejs 版本共存与切换类似的方法

    先安装所需的版本

scoop install nodejs12
scoop install nodejs # 此时默认的node -v输出的是最新版本

    设置需要的版本 / 版本切换

因为 nodejs12 和最新版共用 node 这个命令,只需要执行 reset 加对应的版本就能够将该命令设置为指定版本

切换为 nodejs 12 版本

scoop reset nodejs12

切换为 nodejs 最新版本

scoop reset nodejs

忽略更新

通常我们会使用下面的命令来更新所有通过 scoop 下载的软件

scoop update *

但是有时候我们不想让其中某个软件更新,这个时候就需要用到 hold/unhold 命令

scoop hold postman # 更新软件时禁止 postman 更新
scoop unhold postman # 取消禁止


No comments:

Post a Comment