There is an interesting open-source project on GitHub called vlmcsd (https://github.com/Wind4/vlmcsd) to emulate Microsoft’s KMS activation server. You can use it to deploy your own KMS server on platforms other than Windows Server (thus, you can save on a Windows Server license if you don’t use it). You can install such a KMS server on Linux, Android, FreeBSD, macOS, etc. In this article, we’ll show you how to install vlmcsd-based KMS on a Linux host and use it to activate computers running desktop Windows editions, Windows Server, and Microsoft Office on your local network.
Before you start, we recommend that you familiarize yourself with Microsoft KMS Volume Activation technology. Almost all the necessary information can be found in the Microsoft KMS Volume Activation FAQ.
In this example, we are using Red Hat Enterprise Linux 8 (RHEL) to deploy the KMS host, but you can use any other OSs, such as Ubuntu, Debian, CentOS, Rocky Linux. or even your NAS device (there are some examples of successful installation to a Synology NAS server).
Connect to your Linux server and use the yum (dnf) package manager to install the git and gcc packages:
# dnf update
# dnf install git gcc
Then clone and install the vlmcsd package:
# git clone https://github.com/Wind4/vlmcsd
# cd vlmcsd
# make
Change to the bin directory:
# cd bin
Run the KMS server:
# ./vlmcsd
You will see the following message:
Connecting to 127.0.0.1:1688 ... successful Sending activation request (KMS V6) 1 of 1 -> 55041-00206-559-475403-03-1076-6002.0000-1482020 (3A1C049600B60076)
It means that you have successfully compiled and run the KMS server on Linux.
By default, vlmcsd listens on a default KMS port TCP/1688. So, you have to open the port in your Linux firewall to allow clients to connect to it. For firewalld, run the commands below:
# firewall-cmd --zone=public --permanent --add-port=1688/tcp
# firewall-cmd –reload
Make sure that port 1688 is open:
# firewall-cmd --list-port
# netstat -ntlp | grep LISTEN
To run vlmcsd automatically, you can create your own daemon and manage it using systemd.
# cp vlmcs /usr/bin
# touch /etc/systemd/system/kms-script.service
# chmod 664 /etc/systemd/system/kms-script.service
# nano /etc/systemd/system/kms-script.service
Add the following service description to the file:
[Unit] Description=MSFT KMS Server Emulator After=network.target After=network-online.target Wants=network-online.target [Service] Type=oneshot ExecStart=/usr/bin/vlmcsd RemainAfterExit=yes LimitNOFILE=65536 [Install] WantedBy=multi-user.target
Then run the KMS service and add it to startup:
# systemctl daemon-reload
# systemctl start kms-script.service
# systemctl status kms-script.service
# systemctl enable kms-script.service
You can set advanced KMS server options through the vlmcsd.ini (there is a sample file in ../vlmcsd/etc/). There you can also set a path to the KMS server log file (vlmcsd.log). You can set file paths in the vlmcsd startup options using the following options:
-i /etc/vlmcsd.ini
-l /var/log/vlmcsd.log
sudo docker pull mikolatero/vlmcsd
sudo docker run -d -p 1688:1688 --restart=always --name kms_server mikolatero/vlmcsd /vlmcsd -D -d -t 3 -e -v -R172800 -A10080
If you are using Microsoft DNS, you can create a _VLMCS record that will allow Windows clients to automatically find a KMS server in the domain. To create a DNS SRV record, use the following PowerShell command:
Add-DnsServerResourceRecord -Srv -Name "_VLMCS._tcp" -ZoneName "woshub.com" -DomainName "192.168.14.147" -Priority 0 -Weight 0 -Port 1688
where 192.168.14.147
is an IP address of your Linux host KMS service is running on.
Then all Windows (and Office) hosts in your domain will be automatically activated on your KMS server if they have a public GVLK installed on them. A complete list of GVLK (Generic Volume License Keys) to activate all available Windows versions is published on the Microsoft website: https://docs.microsoft.com/en-us/windows-server/get-started/kms-client-activation-keys.
For example, find GVLK to activate Windows Server 2022 Standard (VDYBN-27WPP-V4HQT-9VMD4-VMK7H) and Windows 10 Pro (W269N-WFGWX-YVC9B-4J6C9-T83GX) on this page.
To activate Windows manually, set the GVLK for your Windows version, the IP address of your KMS activation host, and run the activation command. The following commands are used (for example, for Windows Server 2022 Standard):
slmgr.vbs -ipk VDYBN-27WPP-V4HQT-9VMD4-VMK7H
slmgr.vbs -skms 192.168.14.147
slmgr.vbs -ato
After you run the last command, you will see the message: Product activated successfully
. This means that your Windows copy has been successfully activated.
You can check the Windows activation status using the command:
slmgr.vbs -dlv
Error: 0xC004F069 On a computer running Microsoft Windows non-core edition, run 'slui.exe 0x2a 0xC004F069' to display the error text.
The reason is that I have an evaluation version of Windows Server 2022 installed. First, you need to convert it to a Standard version according to this article:
dism /online /set-edition:serverstandard /productkey:VDYBN-27WPP-V4HQT-9VMD4-VMK7H /accepteula
Then I can activate my Windows instance on the KMS host.
In the same way, you can activate volume versions of Microsoft Office 2019/2016/2013 on your KMS host. The following commands are used:
cd C:\Program Files\Microsoft Office\Office16
cscript ospp.vbs /sethst: 192.168.14.147
cscript ospp.vbs /act
To check Office activation status:
cscript ospp.vbs /dstatusall
So we have shown how to deploy a KMS server on Linux and activate all Windows versions including the latest Windows Server 2022 and Windows 11.
12 comments
Thanks for this content. However, I am not pretty sure to have undesrdtood how this Kms implementation works, compared to the Microsoft official one. I mean, on MS KMS service I need to install the kms “host” keys related to the products that I intend to activate with it. So for example a kms host key for Office 2016, one for Windows 10, etc… Once installed, the clients will try automatically to activate with KMS, after looking for the SRV DNS record of the KMS service.
With the open source KMS where can I install the host key for each product I intend to activate with kms? Or the “piracy” disclaimer in the article is for the fact that this service activates everything even in absence of the host keys?
It would be a nice solution for us, because now we are dependent on the OS license type (ie: Windows Server 2012 R2 **volume**) on which we install the KMS service. In other words, you need to have a volume license type of Windows server, or windows client, to be able to install an OS kms host key on the kms service, otherwise it does not let you install the OS kms host key. You cannot activate kms OSes clients against a kms service installed on a Windows server (or client) OS with an OEM license.
Thank you for the eventual answer and I hope I wrote clearly my concerns.
Francesco
Thank you,
this service activates everything even in absence of the host keys
This statement is true
Thank you. Francesco
Think there is a typo above. The command
cp vlmcs /usr/bin
But then in the creation of the daemon it’s calling /usr/bin/vlmcsd
I noticed that too, it seems it would make sense that it should be the daemon.
“dnf install git gcc” doesnt seem to work and therefore make would error.
“sudo apt install gcc” installed successfully
It all depends on your Linux distro.
Why say these commands work with Debian and other distros… when they definitely do not. Not all of them even contain the needed commands like DNF and even MAKE. We wasted hours setting up various distros looking for the magically one that would actually get this kms server working. We gave up.
Other users are finding typos in the cmds themselves making it 100% impossible to get this working at all… with any distro on the planet.
Why doesn’t the author just cut/paste the a-c-t-u-a-l cmds from their working code???
Does anyone have the fully working cmds instead of this mess?
dnf (ex. yum) is a default package manager in rpm-based Linux distros (rhel/centos/rocky/fedora)
while apt is a package manager in deb distros (debian/ubuntu/mint).
This tutorial is based and tested on CentOS. So, just adopt the command for your Linux version.
I’m trying to Install this on Debian but got stuck at the # Make part. Unsure how to proceed.
The make command is used to build and compile programs from source files. It is not installed by default on most Linux distros.
On Debian it can be installed separately:
# apt-get install make
Or as part of the build-essential metapackage:
# apt-get install build-essential
Hello, i need help from everyone. I try to install this Service.
I can’t finish the installation. It is stop at this Point: root@MYpi:/home/USER/vlmcsd/bin# systemctl start kms-script.service.
The error messages are Job for kms-script.service failed because the control process exited with error code.
See “systemctl status kms-script.service” and “journalctl -xeu kms-script.service” for details.
What make i wrong, all other Point before was completely without errors.
Can everyone help me?
My Pi is an RasPi 4 Model B 4GB with RasPi Lite 64Bit without Desktop.