admin 管理员组

文章数量: 887021

搭建KMS服务器


KMS的有两种方法,分别为vlmcsd和py-kms,这里只用vlmcsd来实现。

#临时关闭selinux
setenforce 0
#永久关闭selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
#关闭防火墙
systemctl stop firewalld
#防火墙开机不启动
systemctl disable firewalld
[root@localhost ~]wget https://github/Wind4/vlmcsd/releases/download/svn1113/binaries.tar.gz
#最新项目文件可访问https://github/Wind4/vlmcsd/releases
[root@localhost local]# cat /proc/cpuinfo		#查看cpu信息
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 79
model name      : Intel(R) Xeon(R) CPU E5-1630 v4 @ 3.70GHz
stepping        : 1
microcode       : 0xb000038
cpu MHz         : 3691.452
cache size      : 10240 KB
physical id     : 0
siblings        : 1
core id         : 0
cpu cores       : 1
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 20
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid rdseed adx smap xsaveopt arat spec_ctrl intel_stibp flush_l1d arch_capabilities
bogomips        : 7382.90
clflush size    : 64
cache_alignment : 64
address sizes   : 43 bits physical, 48 bits virtual
power management:

[root@localhost local]# tar -xzvf binaries.tar.gz
[root@localhost local]# cd binaries/Linux/intel/static
#如果你的机器CPU和上述的一样都是Intel,那么就可以直接用上面的命令进入目录
[root@localhost static]# ll
total 852
-rwxr-xr-x 1 1000 1000 130907 Mar 29  2020 vlmcsdmulti-x64-musl-static
-rwxr-xr-x 1 1000 1000 130556 Mar 29  2020 vlmcsdmulti-x86-musl-static
-rwxr-xr-x 1 1000 1000 130944 Mar 29  2020 vlmcsdmulti-x86-musl-static-threads
-rwxr-xr-x 1 1000 1000  93851 Mar 29  2020 vlmcsd-x64-musl-static
-rwxr-xr-x 1 1000 1000  93756 Mar 29  2020 vlmcsd-x86-musl-static
-rwxr-xr-x 1 1000 1000  94208 Mar 29  2020 vlmcsd-x86-musl-static-threads
-rwxr-xr-x 1 1000 1000  97659 Mar 29  2020 vlmcs-x64-musl-static
-rwxr-xr-x 1 1000 1000  97436 Mar 29  2020 vlmcs-x86-musl-static
[root@localhost static]# ./vlmcsd-x64-musl-static 
#这台是64位的系统选这上面的,其他的则需要在此目录内找到对应你系统位数的可执行文件来运行
[root@localhost static]# ps -ef | grep vlmcsd-x64-musl-static
root       7897      1  0 10:04 ?        00:00:00 ./vlmcsd-x64-musl-static
root       7899   7816  0 10:06 pts/0    00:00:00 grep --color=auto vlmcsd-x64-musl-static
#查看是否运行
#如果要停止vlmcsd
#kill -9 上图使用ps -ef命令回显的vlmcsd进程PID
[root@localhost static]# cp vlmcsd-x64-musl-static  /usr/bin/vlmcsd
[root@localhost static]# touch /var/run/vlmcsd.pid

[root@localhost static]# vi /lib/systemd/system/vlmcsd.service
#复制以下内容
[Unit]
Description=KMS Server By vlmcsd
After=network.target
[Service]
Type=forking
PIDFile=/var/run/vlmcsd.pid
ExecStart=/usr/bin/vlmcsd -p /var/run/vlmcsd.pid
ExecStop=/bin/kill -HUP $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target

[root@localhost static]# systemctl daemon-reload
[root@localhost static]# systemctl start vlmcsd
[root@localhost static]# systemctl status vlmcsd
[root@localhost static]# systemctl enable vlmcsd

KMS 客户端安装密钥:
https://docs.microsoft/zh-cn/windows-server/get-started/kmsclientkeys

#激活,以管理员身份运行cmd,自行替换相应的kms服务器ip
slmgr /skms 10.100.100.100
slmgr /ato
slmgr /xpr		#查看失效时间

#win7激活office,以实际安装版本路径版本为准,以office2016-vol为例
cd C:\Program Files\Microsoft Office\Office16
cscript ospp.vbs /sethst:10.100.100.100
cscript ospp.vbs /act

#非vol版windows
slmgr.vbs -upk
slmgr.vbs -ipk M7XTQ-FN8P6-TTKYV-9D4CC-J462D	#GVLK密钥根据系统版本的不同更换
slmgr.vbs -skms 10.100.100.100
slmgr.vbs -dlv
slmgr.vbs /ato

本文标签: 服务器 KMS