Window包管理工具scoop

自定义安装路径安装

在 PowerShell 中打开远程权限

Set-ExecutionPolicy RemoteSigned -scope CurrentUser;

自定义 Scoop 安装目录

$env:SCOOP='Your_Scoop_Path'
[Environment]::SetEnvironmentVariable('SCOOP', $env:SCOOP, 'User')
如果跳过该步骤, Scoop 将默认把所有用户安装的 App 和 Scoop 本身置于C:\Users\user_name\scoop

下载并安装 Scoop

iwr -useb get.scoop.sh | iex
scoop update

或者
irm https://ghproxy.com/raw.githubusercontent.com/duzyn/scoop-cn/master/install.ps1 | iex

 

要改善 Scoop 的下载速度,详细可以参照CSDN GitHub加速计划上的说明更换下载源。

scoop config SCOOP_REPO 'https://gitcode.net/mirrors/ScoopInstaller/Scoop'

 

  • 更换 bucket 源
scoop install https://ghproxy.com/raw.githubusercontent.com/duzyn/scoop-cn/master/bucket/7zip.json 
scoop install https://ghproxy.com/raw.githubusercontent.com/duzyn/scoop-cn/master/bucket/git.json 
scoop install https://ghproxy.com/raw.githubusercontent.com/duzyn/scoop-cn/master/bucket/aria2.json


scoop bucket rm main
scoop bucket add main https://gitcode.net/mirrors/ScoopInstaller/Main.git
scoop bucket add extras https://gitcode.net/mirrors/ScoopInstaller/Extras.git

或者

git -C "D:\Scoop\buckets\main" remote set-url origin https://gitcode.net/mirrors/ScoopInstaller/Main.git
git -C "D:\Scoop\buckets\extras" remote set-url origin https://gitcode.net/mirrors/ScoopInstaller/Extras.git

基本命令

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

 

#重置应用以解决冲突,会重置环境变量,快捷方式等..
scoop reset *
#检查潜在的问题..执行下看看使用scoop会有什么问题
scoop checkup
#如果使用了aria2感觉慢的话可以关闭
scoop config aria2-enabled false  
#下面是日常更新软件命令
sudo scoop update * -g ; scoop update * ; sudo scoop cleanup * -g ; scoop cleanup *
# 查看 Scoop 还能直接识别哪些 bucket
scoop bucket known


设置代理并多线程下载

命令执行:

scoop config proxy 127.0.0.1:8118

设置配置:

配置文件路径:C:\Users\qhong\.config\scoop

{
    "lastupdate":  "2019-11-09T09:45:50.0880266+08:00",
    "SCOOP_REPO":  "https://github.com/lukesampson/scoop",
    "SCOOP_BRANCH":  "master",
    "proxy":  "127.0.0.1:8118"
}

配置存留persist

这里最值得称道的是persist文件夹,因为我们知道,scoop安装的所有软件都是安装在scoop文件夹下的,那如果软件升级了的话,以前旧软件的设置和数据是不是全部清除了呢?例如vscode上的设置和安装的插件,是不是升级了之后,都没有了呢?不是的,因为scoop会将各个软件的设置数据,例如vscode软件的data文件夹(vscode的设置和插件都放在data文件夹),单独放到persist文件夹中,在用软链接链接到软件所在的文件夹,这样,每次升级软件,persist文件夹的各个软件的设置数据都会保持不变,从而保存设置.

另一个需要注意的是,所有的对scoop操作都不要在文件夹中进行,因为有可能会破坏scoop的文件结构,想要对scoop进行任何操纵,都需要在命令行中进行

桶bucket

在 Scoop 里面,bucket 就是一个软件仓库。Scoop 将一个个仓库缓存至本地,当我们想要安装一个软件的时候,Scoop 就从本地的仓库中挑选出我们想要安装的软件的安装配置文件,并依照这个配置文件进行软件的安装工作。

scoop可以直接识别的bucket

$ scoop bucket known
main
extras
versions
nightlies
nirsoft
php
nerd-fonts
nonportable
java
games
jetbrains

添加常用的bucket

###添加桶
scoop bucket add extras;
scoop bucket add Java;
scoop bucket add versions;
scoop bucket add apps https://gitee.com/kkzzhizhou/scoop-apps

 

建立一个bucket

1.github创建自己的仓库 scoop-buckets
2.拉取到本地,并cd进入
3.按bucket规则创建一个json文件,比如:oraclejdk8.json
4.git推送提交
5.将该git仓库配置为本地的桶即可

案例:

$ scoop bucket add qhong https://gitee.com/hongdada/scoop-buckets
Checking repo... ok
The qhong bucket was added successfully.

$ scoop bucket list
Ash258
dorado
extras
iszy
Java
main
qhong
versions
wangzq

应用

前置安装应用

配置下载:

#下载
scoop install aria2;

只有安装了aria2,可以多线程下载,后面的应用下载才会快

而且必须配置代理,因为桶配置都是放在github

常装应用

scoop install sudo
scoop install git curl 7zip coreutils
#解压
scoop install bandizip;
#浏览器
scoop install chrome;
#cmd
scoop install Cmder;
#文件检索
scoop install everything;
#git,程序员必备
scoop install git;
#包管理
scoop install maven;
#远程终端
scoop install MobaXterm;
#播放器
scoop install potplayer;
#redis
scoop install redis;
#桌面控制
scoop install teamviewer;
#markdown编写
scoop install typora;
#编辑器
scoop install vscode;
#效率启动神器
scoop install WOX;
#离线文档浏览器
scoop install zeal;

scoop install aria2 curl grep sed less touch
scoop install python ruby go perl


###安装全局应用
scoop install mysql56 -g;
scoop install nodejs -g;
scoop install oraclejdk8 -g;
scoop install python36 -g;

aria2下载命令

$ aria2c http://down.sandai.net/thunderx/XunLeiWebSetup10.1.16.466dl.exe

11/12 17:53:33 [NOTICE] Downloading 1 item(s)

11/12 17:53:34 [NOTICE] Download complete: D:/Development/huishi-server/XunLeiWebSetup10.1.16.466dl.exe

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
67cbeb|OK  |    10MiB/s|D:/Development/huishi-server/XunLeiWebSetup10.1.16.466dl.exe

Status Legend:
(OK):download completed.

注意,命令是使用aria2c

scoop reset 命令

安装和切换 Java

scoop reset 将 re-installs 应用程序的 shims ,并根据应用程序的 manifest 更新 PATH 环境变量。

命令格式为:

scoop reset <java>[@<version>]

安装和切换不同的 Java (JDK)版本:

scoop bucket add java

scoop install oraclejdk
Installing 'oraclejdk' (12.0.2-10) [64bit]

scoop install zulu6
Installing 'zulu6' (6.18.1.5) [64bit]

scoop install openjdk10
Installing 'openjdk10' (10.0.1) [64bit]

java -version
openjdk version "10.0.1" 2018-04-17
OpenJDK Runtime Environment (build 10.0.1+10)
OpenJDK 64-Bit Server VM (build 10.0.1+10, mixed mode)

scoop reset zulu6
Resetting zulu6 (6.18.1.5).
Linking ~\scoop\apps\zulu6\current => ~\scoop\apps\zulu6\6.18.1.5

java -version
openjdk version "1.6.0-99"
OpenJDK Runtime Environment (Zulu 6.18.1.5-win64) (build 1.6.0-99-b99)
OpenJDK 64-Bit Server VM (Zulu 6.18.1.5-win64) (build 23.77-b99, mixed mode)

scoop reset oraclejdk

java -version
java version "12.0.2" 2019-07-16
Java(TM) SE Runtime Environment (build 12.0.2+10)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)

Python

scoop bucket add versions # add the 'versions' bucket if you haven't already

scoop install python27 python
python --version # -> Python 3.6.2

# switch to python 2.7.x
scoop reset python27
python --version # -> Python 2.7.13

# switch back (to 3.x)
scoop reset python
python --version # -> Python 3.6.2

 

WindowTerminal

scoop install WindowsTermina
设置右键快捷键:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\WindowsTerminal]
@="Windows Terminal Here"
"Icon"="D:\\Program Files\\Scoop\\apps\\WindowsTerminal\\current\\Images\\Square44x44Logo.targetsize-32.png"

[HKEY_CLASSES_ROOT\Directory\Background\shell\WindowsTerminal\command]
@="D:\\Program Files\\Scoop\\apps\\WindowsTerminal\\current\\WindowsTerminal.exe"

将以上代码保存到扩展名为 .reg 的文件中,双击打开

当前目录打开时,Terminal 里的路径不是当前目录

检查一下配置文件,看下是否有以下内容,删除之后就可以了。

{
    "profiles": [
        {
            "startingDirectory" : "%USERPROFILE%"
        }
    ]
}

需要修改为

"startingDirectory": null

如果没有就自己配置这个参数设置为null

配置文件路径:

C:\Users\qhong\AppData\Local\Microsoft\Windows Terminal\profiles.json

不能输入中文问题

将win10打开设置,时间和语言→语言→管理语言设置→更改系统区域设置→勾选Beta...提供全球语言支持,然后重启,再打开windows terminal即可使用中文输入。然后神奇的事情发生了,即使此时关闭当时的勾选,再次重启仍可在windows terminal使用中文输入法。

2.设置环境变量 LESSCHARSET=utf-8

profiles.json配置

// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation

{
    "$schema": "https://aka.ms/terminal-profiles-schema",

    "defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",

    "globals": {
        "alwaysShowTabs": true,
        "defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
        "initialCols": 98,
        "initialRows": 28,
        "keybindings": [{
                "command": "closeTab",
                "keys": [
                    "ctrl+w"
                ]
            }
        ],
        "requestedTheme": "system",
        "showTabsInTitlebar": true,
        "showTerminalTitleInTitlebar": true
    },
    "profiles": [{
            "acrylicOpacity": 0.75,
            "closeOnExit": true,
            "colorScheme": "Campbell",
            "commandline": "powershell.exe",
            "cursorColor": "#FFFFFF",
            "cursorShape": "bar",
            "fontFace": "Hack",
            "fontSize": 14,
            "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
            "historySize": 9001,
            "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png",
            "name": "Windows PowerShell",
            "snapOnInput": true,
            "startingDirectory": null,
            "useAcrylic": true
        }, {
            // Make changes here to the cmd.exe profile
            "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
            "name": "cmd",
            "commandline": "cmd.exe",
            "hidden": false
        }, {
            "guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
            "hidden": false,
            "name": "Ubuntu-18.04",
            "source": "Windows.Terminal.Wsl"
        }, {
            "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
            "hidden": false,
            "name": "Azure Cloud Shell",
            "source": "Windows.Terminal.Azure"
        }
    ],
    "schemes": [{
            "background": "#0C0C0C",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell",
            "purple": "#881798",
            "red": "#C50F1F",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        }
    ]
}

// Add any keybinding overrides to this array.
// To unbind a default keybinding, set the command to "unbound"
"keybindings": []
}

参考:

官网

官网快速入门

Scoop buckets by Github score

scoop: 国内镜像版 (gitee.com)

Apps | Scoop

Scoop buckets by Github score | scoop-directory (rasa.github.io)

 

posted @ 2020-06-17 17:29  养诚  阅读(1129)  评论(0编辑  收藏  举报