windows server 2022安装winget方法
缘起
公司开始逐渐要求使用云电脑办公了,云电脑主流的都是server系统,且版本不高。
只有新版本的 11+ 及 Server 2025+ 会自带winget,所以需要在老版本上安装winget。
方法
winget微软开源了,地址:
https://github.com/microsoft/winget-cli/
至少需要下载如下3个文件:

安装
- 先顺序安装这三个:
解压DesktopAppInstaller_Dependencies.zip后,打开x64文件夹:

安装脚本:
启动powershell
bash
Import-Module -Name Appx -UseWindowsPowerShell
Add-AppxPackage Microsoft.VCLibs.140.00_14.0.33519.0_x64.appx
Add-AppxPackage Microsoft.VCLibs.140.00.UWPDesktop_14.0.33728.0_x64.appx
Add-AppxPackage Microsoft.WindowsAppRuntime.1.8_8000.616.304.0_x64.appx

- 安装msixbundle
bash
Add-AppxProvisionedPackage -Online -PackagePath .\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle -LicensePath .\e53e159d00e04f729cc2180cffd1c02e_License1.xml

基本设置
winget使用github来存储的,所以必须要安装的是git
bash
winget install Git.Git

安装windows最好用的terminal:
bash
winget install Microsoft.WindowsTerminal

安装微软的linux工具集
bash
winget install Microsoft.Coreutils

这个工具集专门介绍过:
微软把Linux命令搬进Win11:Coreutils开源项目重磅发布
镜像修改
大家网络环境都不是太好,用国内镜像比较好:
bash
# 替换 USTC 镜像
winget source remove winget
winget source add winget https://mirrors.ustc.edu.cn/winget-source
# 重置为官方地址
winget source reset winget
其他安装方法
鉴于低版本系统安装的不方便,还是有大佬总结了一键脚本的:
部署 WinGet 的 PS 脚本到 PowerShell Gallery 仓库
详细减少可以看github:https://gist.github.com/erwinkersten/626ed456c1bd84fd5e023b081d6d450e
使用方法:
bash
Install-Script -Name winget-install
winget-install -Force
这个脚本只是将手工安装自动化了,还是需要网络环境的,我试了失败,才手工安装的,网络好的可以试试
小结
其实windows对应程序员来说,也没必mac差的那么不堪,自己折腾折腾还是可以的。
欢迎关注: