1、安装docker

登录docker官网查看Debian系统安装方式

# 官网安装脚本自动安装(不推荐,此脚本自动安装最新体验版而不是稳定版)
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

2、安装vlmscd

# docker拉取镜像
docker pull mikolatero/vlmcsd
# docker运行容器
docker run -itd -p 1688:1688 --restart=always --name vlmcsd mikolatero/vlmcsd
# 参数含义
 -i 以交互模式运行容器 -t:为容器重新分配一个伪输入终端(it一般同时使用)
 -d 后台运行容器并返回容器终端 -p 端口映射(主机端口:容器端口) --name 为容器指定名称

3、开放防火墙及阿里云安全组端口

1688

4、激活Windows

#以管理员权限打开命令行
win+x+a
# 卸载密钥
slmgr.vbs -upk
# 安装KMS密钥
slmgr.vbs -ipk W269N-WFGWX-YVC9B-4J6C9-T83GX
​
# 设置KMS服务器IP
# 激活
cscript \windows\system32\slmgr.vbs -skms kms.shaunyang.site
# 激活
cscript \windows\system32\slmgr.vbs -ato
# 查看详情信息
slmgr.vbs -dlv
# 激活剩余时间
slmgr.vbs -xpr
​
#查看官网各个版本密钥
https://docs.microsoft.com/zh-cn/windows-server/get-started/kms-client-activation-keys
#win10/11专业版 W269N-WFGWX-YVC9B-4J6C9-T83GX

6、激活OFFICE

#以管理员权限打开命令行
win+x+a
# 两个路径二选一
cd /d %ProgramFiles(x86)%\Microsoft Office\Office16
cd /d %ProgramFiles%\Microsoft Office\Office16
# 安装KMS密钥
cscript ospp.vbs /inpkey:FXYTK-NJJ8C-GB6DW-3DYQT-6F7TH
#如果报错SKU未找到的错误,执行下面语句
for /f %x in ('dir /b ..\root\Licenses16\ProPlus2021VL_KMS*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%x"
# 设置KMS服务器IP
cscript ospp.vbs /sethst:kms.shaunyang.site
# 设置KMS服务器端口号
# cscript ospp.vbs /setprt:1688
# 激活
cscript ospp.vbs /act
# 查看密钥状态
cscript ospp.vbs /dstatusall
​
#=======================================================#
​
# 卸载密钥
cscript ospp.vbs /unpkey:6F7TH
# 删除KMS主机名(将端口设置为默认)
cscript ospp.vbs /remhst
# 查看密钥状态
cscript ospp.vbs /dstatus
​
#查看官网各个版本密钥
https://docs.microsoft.com/zh-cn/DeployOffice/vlactivation/gvlks
# office2021专业增强版 FXYTK-NJJ8C-GB6DW-3DYQT-6F7TH
# office2019专业增强版 NMMKJ-6RK4F-KMJVX-8D9MJ-6MWKP
# Office 专业增强版 2016
XQNVK-8JYDB-WJ9W3-YJ8YR-WFG99
# win11 相关命令
cd "C:\Program Files\Microsoft Office\Office16"
#如果报错SKU未找到的错误,执行下面语句
foreach ($x in Get-ChildItem -Path "..\root\Licenses16\ProPlus2021VL_KMS*.xrm-ms") {
    & cscript ospp.vbs /inslic:"..\root\Licenses16\$($x.Name)"
}
​

7、激活时遇到的一些问题

---Processing--------------------------
---------------------------------------
Installed product key detected - attempting to activate the following product:
SKU ID: cd18ecc0-466a-45d4-8d2e-8c4fa48ae591
LICENSE NAME: Office 21, Office21ProPlus2021R_Grace edition
LICENSE DESCRIPTION: Office 21, RETAIL(Grace) channel
Last 5 characters of installed product key: PG343
ERROR CODE: 0xC004F017
ERROR DESCRIPTION: The Software Licensing Service reported that the license is not installed.
---------------------------------------
Installed product key detected - attempting to activate the following product:
SKU ID: fbdb3e18-a8ef-4fb3-9183-dffd60bd0984
LICENSE NAME: Office 21, Office21ProPlus2021VL_KMS_Client_AE edition
LICENSE DESCRIPTION: Office 21, VOLUME_KMSCLIENT channel
Last 5 characters of installed product key: 6F7TH
<Product activation successful>
​