一键安装KMS服务脚本

技术 秋水逸冰 221382浏览 97评论

KMS,是 Key Management System 的缩写,也就是密钥管理系统。这里所说的 KMS,毋庸置疑就是用来激活 VOL 版本的 Windows 和 Office 的 KMS 啦。经常能在网上看到有人提供的 KMS 服务器地址,那么你有没有想过自己也来搞一个这样的服务呢?而这样的服务在 Github 上已经有开源代码实现了。
本文就是在这个开源代码的基础上,开发了适用于三大 Linux 发行版的一键安装 KMS 服务的脚本。

本脚本适用环境

系统支持:CentOS 6+,Debian 7+,Ubuntu 12+
虚拟技术:任意
内存要求:≥128M
日期  :2018 年 10 月 25 日

关于本脚本

1、本脚本适用于三大 Linux 发行版,其他版本则不支持。
2、KMS 服务安装完成后会加入开机自启动。
3、默认记录日志,其日志位于 /var/log/vlmcsd.log。

使用方法

使用root用户登录,运行以下命令:

wget --no-check-certificate https://github.com/teddysun/across/raw/master/kms.sh && chmod +x kms.sh && ./kms.sh

安装完成后,输入以下命令查看端口号 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 

本脚本安装完成后,会将 KMS 服务加入开机自启动。

使用命令:
启动:/etc/init.d/kms start
停止:/etc/init.d/kms stop
重启:/etc/init.d/kms restart
状态:/etc/init.d/kms status

卸载方法:
使用 root 用户登录,运行以下命令:

./kms.sh uninstall

如何使用 KMS 服务

KMS 服务,用于在线激活 VOL 版本的 Windows 和 Office。
激活的前提是你的系统是批量授权版本,即 VL 版,一般企业版都是 VL 版。而 VL 版本的镜像一般内置 GVLK key,用于 KMS 激活。
下面列表里面含有的产品的 VL 版本或者能使用 key 进入 KMS 通道的产品,都支持使用 KMS 激活。

Office 2019 & Office 2016:https://docs.microsoft.com/en-us/DeployOffice/vlactivation/gvlks
Office 2013:https://technet.microsoft.com/zh-cn/library/dn385360.aspx
Office 2010:https://technet.microsoft.com/zh-cn/library/ee624355(v=office.14).aspx
Windows:https://docs.microsoft.com/zh-cn/windows-server/get-started/kmsclientkeys

使用管理员权限运行 cmd 查看系统版本,命令如下:

wmic os get caption

使用管理员权限运行 cmd 安装从上面列表得到的 key,命令如下:

slmgr /ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx

使用管理员权限运行 cmd 将 KMS 服务器地址设置为你自己的 IP 或 域名,后面最好再加上端口号(:1688),命令如下:

slmgr /skms Your IP or Domain:1688

注意:本脚本所做的工作就是此步骤。当你的 KMS 服务出于启动状态,那么此处就可以设置为你自己的 KMS 服务器地址。
使用管理员权限运行 cmd 手动激活系统,命令如下:

slmgr /ato

关于 Office 的激活,要求必须是 VOL 版本,否则无法激活。
找到你的 Office 安装目录,32 位默认一般为 C:\Program Files (x86)\Microsoft Office\Office16
64 位默认一般为 C:\Program Files\Microsoft Office\Office16
Office16 是 Office 2016,Office15 就是 Office 2013,Office14 就是 Office 2010。
打开以上所说的目录,应该有个 OSPP.VBS 文件。
使用管理员权限运行 cmd 进入 Office 目录,命令如下:

cd "C:\Program Files (x86)\Microsoft Office\Office16"

使用管理员权限运行 cmd 注册 KMS 服务器地址:

cscript ospp.vbs /sethst:Your IP or Domain

使用管理员权限运行 cmd 手动激活 Office,命令如下:

cscript ospp.vbs /act

注意: KMS 方式激活,其有效期只有 180 天。
每隔一段时间系统会自动向 KMS 服务器请求续期,请确保你自己的 KMS 服务正常运行。

常见错误的对策

如果遇到在执行过程报错,请按以下步骤检查:
1,你的 KMS 服务器是否挂了?
2,你的 KMS 服务是否正常开启?
3,你的系统或 Office 是否为批量 VL 版本?
4,你的系统或 Office 是否修改过 Key 或未安装 GVLK Key?
5,你是否以管理员权限运行 cmd?
6,你的网络连接是否正常?
7,你的本地 DNS 解析是否正常?
8,如果你排除了以上的对策,那请根据错误提示代码自行搜索原因。

更新日志

2018 年 10 月 25 日:修正 vlmcsd 的 git 链接,即每次全新安装皆为官方的最新版本。注意:如果你想升级版本,则需要先停止 kms 服务,再删除 /usr/bin/vlmcsd 文件,然后重新下载最新脚本安装即可。

参考链接

https://03k.org/kms.html

转载请注明:秋水逸冰 » 一键安装KMS服务脚本

发表我的评论
取消评论

请输入正确答案后提交评论 *超出时限。 请再次填写验证码。

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (97)

  1. 您好,问一下用脚本安装的KMS服务器最多支持多少个客户端激活呢?
    xiaoduhappy5年前(2019-04-18)回复
  2. 很棒的,在vultr上用了很久。没想到收到了微软的律师函……吓得我赶紧卸载了……
    Ncc5年前(2019-02-25)回复
  3. 请问如果开启防火墙的话,是不是必须ufw allow 1688?
    RaulMee5年前(2019-02-22)回复
  4. 查看1688监听情况如果返回netstat: command not found请运行 yum install net-tools选y安装
    sundiom5年前(2019-01-08)回复
  5. 老哥,这个在树莓派上不支持吗?怎么办? ---------- System Information ---------- OS : Raspbian GNU/Linux 9 Arch : armv7l (32 Bit) Kernel : 4.14.79-v7+ ---------------------------------------- Auto install KMS Server URL: https://teddysun.com/530.html ---------------------------------------- Press any key to start...or Press Ctrl+C to cancel Error: OS is not be supported, please change to CentOS/Debian/Ubuntu and try again.
    olo5年前(2018-12-25)回复
  6. 在Vultr的Ubuntu 18.04 x64服务器上使用这个脚本安装会报错,需要额外安装glibc-doc和libc6-dev,命令如下: apt install glibc-doc apt install libc6-dev
    Fred5年前(2018-12-23)回复
  7. windows 7旗舰版可以激活吗?试了一下说是被kms服务器拒绝
    omega5年前(2018-11-27)回复
  8. 收到微软的侵权投诉了,服务器被搬瓦工封了 Dear Sir or Madam, We are contacting you concerning the domain/IP address/port listed above which appears to be on servers under your control. The (IP) address is engaged in unauthorized activities relating to copyrighted works published by Microsoft Corporation. It is making it possible for third parties to activate unauthorized and infringing copies of Microsoft software. The IP address at which a KMS machine may be accessed is as follows: ? Statement of Authority: The information in this notice is accurate, and I hereby certify under penalty of perjury that I am authorized to act on behalf of Microsoft Corporation, the owner or exclusive licensee of the copyright(s) in the work(s) identified above. I have a good faith belief that none of the materials or activities listed above have been authorized by Microsoft Corporation, its agents, or the law. ? ACTION REQUESTED (Please complete within 24-hours of receiving this notice): We hereby give notice of these activities to you and request that you take expeditious action to remove or disable access to the material described above, and thereby prevent the unauthorized distribution of these cracks and product keys via your company's network. Please contact me at your earliest opportunity through one of the means listed below to confirm that appropriate action has been taken to secure the KMS machine. We appreciate your cooperation in this matter. Please advise us regarding what actions you take. Yours sincerely, Gareth Young Internet Investigator
    user5年前(2018-11-22)回复
    • 换一家抗投诉的服务商吧。
      秋水逸冰5年前(2018-11-23)回复
    • 谢谢!辛亏看到了,差点就安装了,哈哈哈
      xingfu懒人5年前(2019-01-28)回复
    • Me too
      GoogleGo5年前(2019-02-12)回复
  9. vlmcsd更新到1112了
    index6年前(2018-10-25)回复
    • 谢谢提醒,脚本已经更新。 现在安装的话,就是最新版本了。
      秋水逸冰6年前(2018-10-25)回复
      • 为什么不推出能改端口的KMS脚本啊,Padavan固件的路由器自带的KMS功能,都支持自定义端口。自定义端口后,被微软发现的机率应该会低不少的。
        lmc5年前(2018-11-28)回复
        • 手动修改端口成功了,需要改端口的可以照这样来操作。编辑/etc/init.d/kms文件,将$DAEMON -p $PID_FILE这段改成$DAEMON -P(端口号) -p $PID_FILE,如$DAEMON -P30000 -p $PID_FILE,即端口号改成30000。然后重启KMS服务,搞定。
          lmc5年前(2018-12-22)回复
          • 正解
            adiaos4年前(2020-01-16)回复
  10. Project和Visio 不能激活
    snajdan6年前(2018-10-17)回复
  11. -bash: wget: command not found 是失效了吗。。。
    Chommy6年前(2018-10-08)回复
  12. 想请问一下,现在支持激活office2019 vl版吗
    why6年前(2018-10-04)回复
    • 理论上是支持的。 我新搞了个 Windows Server 2019,都是支持的。
      秋水逸冰6年前(2018-10-07)回复
      • Visio 2019和 project2019激活不了
        chrome6年前(2018-10-24)回复
  13. 请问Visio和Project怎么激活?
    pipi6年前(2018-10-03)回复
  14. ./kms.sh: line 163: make: command not found Error: Install KMS Server failed, please check it and try again.
    seti6年前(2018-09-04)回复
  15. 关于office的激活补充一点: 今天搞了半天没法激活office vol,后来用 cscript ospp.vbs /dstatus 查看了kms信息,发现默认端口是1686。 所以设定ip后需要增加一条命令改端口 cscript ospp.vbs /setprt:1688 然后再执行 cscript ospp.vbs /act 搞定
    slinerd6年前(2018-09-02)回复