Win下包管理工具Scoop的简单应用

Scoop官网

第三方仓库1

第三方仓库2

第三方仓库3

安装

自定义安装目录并安装scoop

$env:SCOOP='D:\scoop'

[environment]::setEnvironmentVariable('SCOOP',$env:SCOOP,'User')

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

PS C:\Users\xuzi> $env:SCOOP='D:\scoop'
PS C:\Users\xuzi> [environment]::setEnvironmentVariable('SCOOP',$env:SCOOP,'User')
PS C:\Users\xuzi> Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
Initializing...
Downloading scoop...
Extracting...
Creating shim...
Downloading main bucket...
Extracting...
Adding D:\scoop\shims to your path.
'lastupdate' has been set to '2021-12-03T11:54:30.4781577+08:00'
Scoop was installed successfully!
Type 'scoop help' for instructions.

scoop checkup 检查可能存在的问题

安装之后一般系统环境变量是设置好了的,但是有些软件的文件关联,右键菜单之类需要手动添加,可以先scoop info ,看看有没有相关配置说明参考

使用

安装断点续传工具

scoop install aria2

PS C:\Users\AUGUR> scoop install aria2
Installing 'aria2' (1.36.0-1) [64bit]
aria2-1.36.0-win-64bit-build1.zip (2.3 MB) [==================================================================] 100%
Checking hash of aria2-1.36.0-win-64bit-build1.zip ... ok.
Extracting aria2-1.36.0-win-64bit-build1.zip ... done.
Linking D:\scoop\apps\aria2\current => D:\scoop\apps\aria2\1.36.0-1
Creating shim for 'aria2c'.
'aria2' (1.36.0-1) was installed successfully!

配置

scoop config aria2-max-connection-per-server 16
scoop config aria2-split 16
scoop config aria2-min-split-size 1M 

常用命令


scoop help #查看帮助
scoop help <某个命令> # 具体查看某个命令的帮助
 
scoop install <app>   # 安装 APP
scoop uinstall <app>  # 卸载 APP
 scoop install oraclejdk8 -g; # 全局安装
scoop list  # 列出已安装的 APP
scoop search # 搜索 APP
scoop status # 检查哪些软件有更新
 
scoop update # 更新 Scoop 自身
scoop update appName1 appName2 # 更新某些app
scoop update *  # 更新所有 app (前提是需要在apps目录下操作)
 
scoop bucket known #通过此命令列出已知所有 bucket(软件源)
scoop bucket add bucketName #添加某个 bucket
 
scoop cache rm <app> # 移除某个app的缓存


# 安装之前,通过 search 搜索 APP, 确定软件名称
scoop search  xxx
 
# 安装 APP
scoop install AppName
 
# 安装特定版本的 APP;语法 AppName@[version],示例
scoop install git@2.23.0.windows.1
 
# 卸载 APP 
scoop uninstall #卸载 APP

添加第三方仓库

# 先添加bucket
scoop bucket add extras
scoop bucket add nirsoft
scoop bucket add dorado https://github.com/h404bi/dorado
scoop bucket add Ash258 'https://github.com/Ash258/Scoop-Ash258.git'
scoop bucket add nerd-fonts
# 对于开发人员,可添加下面的两个
scoop bucket add java
scoop bucket add versions

scoop bucket add dorado https://github.com/h404bi/dorado
# 安装指定仓库软件
scoop install dorado/<App 名>

更新软件


scoop update # 更新 Scoop 自身
 
scoop update appName1 appName2 # 更新某些app
 
# 更新所有 app (可能需要在apps目录下操作)
scoop update *
 
# 禁止某程序更新
scoop hold <app>
# 允许某程序更新
scoop unhold <app>

清除缓存和旧版本

# 查看所有以下载的缓存信息
scoop cache show
 
# 清除指定程序的下载缓存
scoop cache rm <app>
 
# 清除所有缓存
scoop cache rm *
 
# 删除某软件的旧版本
scoop cleanup <app>
 
# 删除全局安装的某软件的旧版本
scoop cleanup <app> -g
 
# 删除过期的下载缓存
scoop cleanup <app> -k

同一个软件切换不同版本

scoop reset idea-ultimate-eap@201.6668.13
 
scoop reset idea-ultimate-eap@201.6073.9
 
# 切换到最新版本
scoop reset idea-ultimate-eap

重置

scoop reset *

它会重置所有的环境变量、快捷方式以解决冲突。

安装mysql

 scoop install mysql
Updating Scoop...
error: RPC failed; curl 28 OpenSSL SSL_read: Connection was reset, errno 10054
fatal: expected flush after ref listing
Scoop update failed.
Installing 'mysql' (8.0.27) [64bit]
mysql-8.0.27-winx64.zip (209.4 MB) [==========================================================================] 100%
Checking hash of mysql-8.0.27-winx64.zip ... ok.
Extracting mysql-8.0.27-winx64.zip ... done.
Running pre-install script...
Linking ~\scoop\apps\mysql\current => ~\scoop\apps\mysql\8.0.27
Creating shim for 'ibd2sdi'.
Creating shim for 'innochecksum'.
Creating shim for 'lz4_decompress'.
Creating shim for 'myisamchk'.
Creating shim for 'myisamlog'.
Creating shim for 'myisampack'.
Creating shim for 'myisam_ftdump'.
Creating shim for 'mysql'.
Creating shim for 'mysqladmin'.
Creating shim for 'mysqlbinlog'.
Creating shim for 'mysqlcheck'.
Creating shim for 'mysqld'.
Creating shim for 'mysqldump'.
Creating shim for 'mysqlimport'.
Creating shim for 'mysqlpump'.
Creating shim for 'mysqlshow'.
Creating shim for 'mysqlslap'.
Creating shim for 'mysql_config_editor'.
Creating shim for 'mysql_secure_installation'.
Creating shim for 'mysql_ssl_rsa_setup'.
Creating shim for 'mysql_tzinfo_to_sql'.
Creating shim for 'mysql_upgrade'.
Creating shim for 'my_print_defaults'.
Creating shim for 'perror'.
Creating shim for 'zlib_decompress'.
Persisting data
Persisting my.ini
Running post-install script...
WARN  Initializing data directory ...
True
WARN  Database has been initialized (username: root, password: <blank>)
'mysql' (8.0.27) was installed successfully!
Notes
-----
Run 'mysqld --standalone' or 'mysqld --console' to start the Database,
or run following command as administrator to register MySQL as a service. See:
https://dev.mysql.com/doc/refman/en/windows-start-service.html

mysqld --install MySQL --defaults-file="C:\Users\AUGUR\scoop\apps\mysql\current\my.ini"

To stop and/or delete the Service run 'sc stop MySQL' and 'sc delete MySQL'.
'mysql' suggests installing 'extras/vcredist2017'.

启动mysql服务 mysqld --console

测试是否可以连接上mysql客户端

mysql -u root -p

> mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.27 MySQL Community Server - GPL

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

客户端连接数据库

或者用另外的方式配置mysql

# 初始化本地数据库
mysqld --initialize
# 安装 MySQL 服务
mysqld --install mysql
# 启动 MySQL 服务
sc start mysql
# 使用初始密码进入 MySQL:初始密码为空
# mysql -u root -p
# 运行数据库
mysqld --console
# 修改 MySQL 8 的密码插件及初始密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
# 退出数据库
quit;
# 停止 MySQL 服务
sc stop mysql

本文链接:

https://xuzi.vercel.app/archive/1638499150/

# 最新文章