安装msys2
# Windows使用choco包管理器安装msys2
choco install msys2 -y
把msys2集成到Windows Terminal中
参考: https://blog.csdn.net/chenxizhan1995/article/details/109609823
将下方的json
配置添加到profile.defaults.list
中
{
// MSYS2
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6301}",
"name": "MSYS2",
"commandline": "C:\\tools\\msys64\\msys2_shell.cmd -msys -defterm -no-start",
"hidden": false,
"fontSize":12,
"tabTitle":"MSYS2",
// "colorScheme":"Campbell Powershell",
"colorScheme":"Campbell",
"startingDirectory":"%userprofile%",
"suppressApplicationTitle":true
}
pacman常用命令
参考: https://blog.csdn.net/mozart_cai/article/details/92385567
# 升级系统及所有已经安装的软件
pacman -Syu
# 安装软件。也可以同时安装多个包,只需以空格分隔包名即可
pacman -S 软件名
# 删除软件,同时删除本机上只有该软件依赖的软件
pacman -Rs 软件名
# 删除软件,同时删除不再被任何软件所需要的依赖
pacman -Ru 软件名
# 在仓库中搜索含关键字的软件包,并用简洁方式显示
pacman -Ssq 关键字
# 搜索已安装的软件包
pacman -Qs 关键字
# 查看某个软件包信息,显示软件简介,构架,依赖,大小等详细信息
pacman -Qi 软件名
# 列出软件仓库上所有的软件包组
pacman -Sg
# 查看某软件包组所包含的所有软件包
pacman -Sg 软件包组
#清理未安装的包文件,包文件位于 /var/cache/pacman/pkg/ 目录
pacman -Sc
#清理所有的缓存文件
pacman -Scc
配置proxy
参考: https://blog.csdn.net/omaidb/article/details/116019501
步骤和Linux
配置proxy
完全一致,msys2
不支持socks5
编辑msys64
下用户的.bashrc
添加proxy
export http_proxy="http://proxy.ibm.com:912"
export https_proxy="http://proxy.ibm.com:912"
export all="http://proxy.ibm.com:912"
然后source
一下.bashrc
即可.
msys2修改国内源
参考: https://mirrors.tuna.tsinghua.edu.cn/help/msys2/
源
文件包括:
C:\tools\msys64\etc\pacman.d\mirrorlist.mingw
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw
C:\tools\msys64\etc\pacman.d\mirrorlist.mingw32
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686
C:\tools\msys64\etc\pacman.d\mirrorlist.mingw64
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/x86_64
C:\tools\msys64\etc\pacman.d\mirrorlist.ucrt64
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/ucrt64
C:\tools\msys64\etc\pacman.d\mirrorlist.clang32
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/clang32
C:\tools\msys64\etc\pacman.d\mirrorlist.clang64
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/clang64
C:\tools\msys64\etc\pacman.d\mirrorlist.msys
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/$arch
修改完源之后,执行pacman -Sy
刷新源.
msys2访问其他盘
# 访问E盘
cd /e/
# 访问E盘子目录
cd /c/opt
## 如果子目录有空格,必须用双引号引起来
cd "/c/Program Files"