Ubuntu搭建KMS服务
Ubuntu搭建KMS服务
py-kms文档:https://py-kms.readthedocs.io/en/latest/index.html
放行KMS端口
ufw allow 1688/tcp
下载并解压 py-kms-master.zip
# 解压
unzip py-kms-master.zip
# 移动到/opt目录
mv py-kms-master/py-kms /opt/py-kms
# 切换到应用目录
cd /opt/py-kms
# 创建python虚拟环境
python3 -m venv .venv
# 激活虚拟环境
source .venv/bin/activate
# 运行测试
python3 pykms_Server.py 0.0.0.0 1688
Windows激活命令
# 绑定KMS地址
cscript /nologo "%windir%\system32\slmgr.vbs" /skms 172.16.0.1
# 激活系统
cscript /nologo "%windir%\system32\slmgr.vbs" /ato
py-kms激活过程
# 密钥管理服务计算机名称成功地设置为 172.16.0.1。 Client sending
Server received RPC Bind Request !!! <===============Server parsing RPC Bind Request...Server generating RPC Bind Response...Client receiving
Server sending RPC Bind Response... ===============>RPC Bind acknowledged !!!# 正在激活 Windows Server(R), ServerEnterprise edition (620e2b3d-09e7-42fd-802a-17a13652fe7a) ...
# 成功地激活了产品。Client sending
Server received RPC Activation Request !!! <===============Server parsing RPC Activation Request...Server processing KMS Activation Request...Module 'tzlocal' not available ! Request time not localized.Server processing KMS Activation Response...Server generating RPC Activation Response...Client receiving
Server sending RPC Activation Response... ===============>Server responded, now in Stand by...
使用systemd管理py-kms
/etc/systemd/system/py-kms.service
[Unit]
Description=py3-kms
After=network.target
StartLimitIntervalSec=0[Service]
Type=simple
Restart=always
RestartSec=1
KillMode=process
User=root
ExecStart=/opt/py-kms/.venv/bin/python3 /opt/py-kms/pykms_Server.py 0.0.0.0 1688[Install]
WantedBy=multi-user.target
刷新服务
systemctl daemon-reload
使用systemd管理KMS服务
# 启动服务
systemctl start py-kms.service
# 服务自启动
systemctl enable py-kms.service
# 重启服务
systemctl restart py-kms.service