/Linux / /windows / /学习笔记 · 2023年 5月 14日 0

windows&office激活KMS服务器搭建

利用VLMCSD部署KMS服务器
一、Windows部署
1、下载vlmcsd服务端的安装包
下载地址:https://github.com/Wind4/vlmcsd/releases
注意,下载编译好的包,名称为:binaries.tar.gz
Github访问慢的话可以直接下载我下载好的:
https://fyds.lanzouy.com/ihYzm0t6ihfg
密码:hdno
file
2、解压缩安装包并安装启动
选择自己的服务器系统对应的版本这里选择Windows的,进入脚本位置执行对应的脚本:
脚本位置:binaries\Windows\intel
file
执行脚本:
以管理员身份运行cmd进入对应的文件夹
cd binaries\Windows\intel
file
创建KMS服务
vlmcsd-Windows-x64.exe -s
file
查看系统多出一个名为Key Management Server服务
sc query state= inactive | findstr "Key Management Server"
file
服务创建默认不开启,要手动开启
net start "Key Management Server"
file
添加防火墙1688端口权限
netsh advfirewall firewall add rule name="Key Management Server" dir=in action=allow protocol=TCP localport=1688
file
或者打开防火墙添加规则放行端口
file
PS: 程序运行默认是1688端口,如果防火墙开启,需要配置防火墙放行端口,服务器有云防火墙(安全组)的也要添加下放行规则。
3、查看是否已经运行
windows dos查看 netstat -ano |findstr "1688"
file
4、如果正常运行,可以使用服务器激活windows系统和office了
Windows激活命令:
slmgr -upk #卸载密钥
slmgr -ipk W269N-WFGWX-YVC9B-4J6C9-T83GX #安装GVLkey(不同操作系统KEY见附录),如果是VL批量版本并没有手动安装过任何KEY可略过此步
slmgr -skms [KMS服务器域名/IP] #设置kms服务器
slmgr -ato #执行激活
slmgr -xpr #查看激活时效
office激活命令:
cd C:\Program Files\Microsoft Office\Office16 #进入Offiice目录
cscript ospp.vbs /inpkey:YC7DK-G2NP3-2QQC3-J6H88-GVGXT #安装GVLkey(不同版本Officekey见附录),如果是VL批量版本并没有手动安装过任何KEY可略过此步;
cscript ospp.vbs /sethst:[KMS服务器域名/IP] #设置kms服务器,sethst:后面没有空格
cscript ospp.vbs /act #执行激活
5、测试
激活Windows 10专业版系统进行测试:(我的服务器绑定了域名jhw.lanan.fun)
绑定域名:
file
slmgr -upk
slmgr -ipk W269N-WFGWX-YVC9B-4J6C9-T83GX
slmgr -skms jhw.lanan.fun
slmgr -ato
file
file
file
file
file
二、Linux部署
1、下载vlmcsd服务端安装包:(下载太慢也可下载到本地后上传到服务器上)
wget https://github.com/Wind4/vlmcsd/releases/download/svn1113/binaries.tar.gz
因下载太慢我手动上传了
file
2、解压:tar -zxvf binaries.tar.gz
file
3、查看Linux物理机的CPU信息:cat /proc/cpuinfo
file
4、挑选对应CPU版本的程序,一般为Intel:cd binaries/Linux/intel/static/
file
5、修改权限:chmod u+x vlmcsd-x64-musl-static
6、运行vlmcsd:./vlmcsd-x64-musl-static
7、查看运行状态:netstat -tupln |grep 1688
file
8、放行防火墙规则:firewall-cmd –zone=public –add-port=1688/tcp –permanent
重新载入配置用于生效:firewall-cmd –reload
file
9、设置开机自动启动:echo "/root/kms/binaries/Linux/intel/static/vlmcsd-x64-musl-static" >> /etc/rc.local # 为了使用方便,可以将执行文件拷贝到"/usr/bin"目录下,并重命名为kms:
mv /root/kms/binaries/Linux/intel/static/vlmcsd-x64-musl-static /usr/bin/kms && chmod +x /usr/bin/kms
10、安装运行成功,测试同Windows一样(这里绑定域名jh.lanan.fun)
三、Docker部署
1、安装docker:yum install docker
file
2、启动docker并设置开机自启
systemctl start docker
systemctl enable docker
file
3、拉取kms-server镜像
docker镜像地址:https://hub.docker.com/r/mogeko/vlmcsd
docker pull mogeko/vlmcsd
file
4、运行容器
docker run -itd -p 1688:1688 –name kms mogeko/vlmcsd
file
5、设置容器开机自启
docker update –restart=always kms
file
6、宿主机防火墙放行端口
file
7、报错解决
问题报错:WARNING: IPv4 forwarding is disabled. Networking will not work
file
问题原因:
没有开启转发,docker网桥配置完后,需要开启转发,不然容器启动后,就会没有网络,配置/etc/sysctl.conf,添加net.ipv4.ip_forward=1
问题解决:
修改文件
vim /etc/sysctl.conf
net.ipv4.ip_forward=1 #添加此行配置
注:也可修改此文件:/usr/lib/sysctl.d/00-system.conf
file
重启network和docker服务
systemctl restart network && systemctl restart docker
查看是否修改成功
sysctl net.ipv4.ip_forward
如果返回为“net.ipv4.ip_forward = 1”则表示修改成功
file
再次执行查看,使用docker不再报错
file
8、测试服务器问题1688端口还不通,还没处理。
file
四、附录


官方key:
https://learn.microsoft.com/en-us/windows-server/get-started/kms-client-activation-keys

Windows/Office KMS Key(网上找的,并未全部测试)
Windows KMS Client Setup Keys: 
Windows 10 Professional W269N-WFGWX-YVC9B-4J6C9-T83GX 
Windows 8.1 Professional GCRJD-8NW9H-F2CDX-CCM8D-9D6T9 
Windows 7 Professional FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4 
Windows Server 2012 R2 Server Standard D2N9P-3P6X9-2R39C-7RTCD-MDVJX 
Windows Server 2008 R2 Standard YC6KT-GKW9T-YTKYR-T4X34-R7VHC  

Office Generic Volume License Keys for KMS: 
Office Professional Plus 2019 NMMKJ-6RK4F-KMJVX-8D9MJ-6MWKP 
Office Professional Plus 2016 XQNVK-8JYDB-WJ9W3-YJ8YR-WFG99 
Office Professional Plus 2013 YC7DK-G2NP3-2QQC3-J6H88-GVGXT