在Centos下搭建KMS服务器

下载地址https://github.com/lixuy/vlmcsd/tree/master/binaries

1.在vlmcsd/binaries/Linux/intel/glibc/文件夹,找到该文件夹下的vlmcsd-x86-glibc,如果是64位则是vlmcsd-x64-glibc,其他系统自行选择,服务端主要是找vlmcsd这个程序。

2.复制文件

在/usr/local新建vlmcsd,拷贝vlmcsd-x86-glibc到该文件夹下

mkdir /usr/local/vlmcsd
cp vlmcsd-x86-glibc /usr/local/vlmcsd/ 

给vlmcsd-x86-glibc加入执行权限,并改名为vlmscd

cd /usr/local/vlmcsd/  
chmod u+x vlmcsd-x86-glibc  
mv vlmcsd-x86-glibc vlmcsd

3.测试启动

./vlmcsd

查看执行的进程

ps aux|grep vlmcsd 

结果

root      8227  0.0  0.0   2364   240 ?        Ss   11:41   0:00 ./vlmcsd  
root      8279  0.0  0.0   2280   552 pts/1    S+   11:42   0:00 grep vlmcsd  

说明进程已经启动 kill pid可以关闭进程

如果有其他端口占用1688,会报如下错误

Warning: 0.0.0.0:1688: Address already in use  
Fatal: Could not listen on any socket

找出占用的进程关闭即可,可以使用lsof命令和netstat命令

上文中supervisor关闭命令为

supervisorctl shutdown 

4.开机自启

把命令加到/etc/rc.local或/etc/rc.d/rc.local,并加上可执行权限,为了查看日志,加上vlmcsd -l /var/log/vlmcsd.log

echo "/usr/local/vlmcsd/vlmcsd -l /var/log/vlmcsd.log > /dev/null 2>&1" >> /etc/rc.local  
chmod +x /etc/rc.local

注意:CentOS 7中系统启动管理已经由传统的Linux SysV init改为systemd,配置方法跟原来的不一样

5.重启服务器 

reboot

6.客户端测试

windows找到\binaries\Windows\intel目录下的vlmcs-Windows-x86.exe对于64位的找vlmcs-Windows-x64.exe,将其改名为vlmcs.exe;cd跳转到改目录下.执行命令

vlmcs.exe -v -l 3 www.kms123.com

-v输出详细信息
-l 3表示发送Windows Server 2008 Datacenter的激活请求,具体版本对应列表可以通过vlmcs.exe -x查看

www.kms123.com表示KMS服务器的域名

Request Parameters  
==================  
   
Protocol version                : 4.0  
Client is a virtual machine     : No  
Licensing status                : 2 (OOB grace)  
Remaining time (0 = forever)    : 43200 minutes  
Application ID                  : 55c92734-d682-4d71-983e-d6ec3f16059f (Windows)  
Activation ID (Product)         : 68b6e220-cf09-466b-92d3-45cd964b9509 (Windows Server 2008 Datacenter)  
Key Management Service ID       : 8a21fdf3-cbc5-44eb-83f3-fe284e6680a7 (Windows 2008 C)  
Client machine ID               : 53532ed6-0511-4848-ad75-40e3944c3b99  
Previous client machine ID      : 00000000-0000-0000-0000-000000000000  
Client request timestamp (UTC)  : 2015-12-16 05:39:30  
Workstation name                : ftp.htc.info  
N count policy (minimum clients): 5  
   
Connecting to 1.2.3.4:1688 ... successful  
   
Performing RPC bind ...  
... NDR64 ... BTFN ... NDR32 ... successful  
Sending activation request (KMS V4) 1 of 1  
   
Response from KMS server  
========================  
   
Size of KMS Response            : 160 (0xa0)  
Protocol version                : 4.0  
KMS host extended PID           : 03612-00206-183-962764-03-4108-10240.0000-2582015  
Client machine ID               : 53532ed6-0511-4848-ad75-40e3944c3b99  
Client request timestamp (UTC)  : 2015-12-16 05:39:30  
KMS host current active clients : 10  
Renewal interval policy         : 10080  
Activation interval policy      : 120  

你可能感兴趣的:(在Centos下搭建KMS服务器)