1. 一键安装包(本脚本安装完成后,会将 KMS 服务加入开机自启动)
wget --no-check-certificate https://github.com/teddysun/across/raw/master/kms.sh && chmod +x kms.sh && ./kms.sh
如果是国内的服务器可能无法下载成功,尝试以下命令
wget --no-check-certificate -O kms.sh https://pa.ci/download/shell/kms.sh && chmod +x kms.sh && bash kms.sh
安装完成如下所示
2.安装完成后,输入以下命令查看端口号 1688 的监听情况
netstat -nxtlp | grep 1688
返回值类似于如下这样就表示 OK 了: tcp 0 0 0.0.0.0:1688 0.0.0.0:* LISTEN 3200/vlmcsd tcp 0 0 :::1688 :::* LISTEN 3200/vlmcsd
3.使用方法
启动:bash kms.sh start
停止:bash kms.sh stop
重启:bash kms.sh restart
状态:bash kms.sh status
卸载方法:bash kms.sh uninstall
也可以这么写
启动:/etc/init.d/kms start
停止:/etc/init.d/kms stop
重启:/etc/init.d/kms restart
状态:/etc/init.d/kms status
卸载方法:./kms.sh uninstall
4.激活office
(1)cscript ospp.vbs /sethst:VPS的IP或者绑定的域名
/* 例如 windows下 进入D:\Program Files\Microsoft Office\Office16 cscript ospp.vbs /sethst:144.168.62.230 D:\Program Files\Microsoft Office\Office16>cscript ospp.vbs /sethst:xxx.xxx.xxx.xxx Microsoft (R) Windows Script Host Version 5.812 版权所有(C) Microsoft Corporation。保留所有权利。 ---Processing-------------------------- --------------------------------------- Successfully applied setting. --------------------------------------- ---Exiting----------------------------- */
(2)cscript ospp.vbs /act /*立即激活*/
/* D:\Program Files\Microsoft Office\Office16>cscript ospp.vbs /act Microsoft (R) Windows Script Host Version 5.812 版权所有(C) Microsoft Corporation。保留所有权利。 ---Processing-------------------------- --------------------------------------- Installed product key detected - attempting to activate the following product: SKU ID: d450596f-894d-49e0-966a-fd39ed4c4c64 LICENSE NAME: Office 16, Office16ProPlusVL_KMS_Client edition LICENSE DESCRIPTION: Office 16, VOLUME_KMSCLIENT channel Last 5 characters of installed product key: WFG99 <Product activation successful> --------------------------------------- --------------------------------------- ---Exiting----------------------------- */
(3)cscript ospp.vbs /dstatus /*查看状态*/
/* REMAINING GRACE: 180 days (259200 minute(s) before expiring) Last 5 characters of installed product key: WFG99 Activation Type Configuration: ALL DNS auto-discovery: KMS name not available KMS machine registry override defined: xxx.xxx.xxx.xxx:1688 Activation Interval: 120 minutes Renewal Interval: 10080 minutes KMS host caching: Enabled */
如果出现错误:
(1)/* -bash: netstat: command not found*/
yum install net-tools
常见问题
- 如果非vps,如腾讯云或者阿里云必须开放1688端口
- 安装KMS脚本需要挂载VPN才能有