Link Search Menu Expand Document

Key Management Service on Ubuntu

This is how I used kms-server on an Ubuntu server 20.04.

Table of contents
  1. Getting started
    1. Prerequisites
    2. Update
    3. Install qemu-guest-agent
    4. Set your time zone
  2. Installing the KMS server
    1. Start the KMS daemon
    2. Test with KMS client
  3. Configuring the KMS daemon to run at boot
  4. Windows configuration
  5. Authors
  6. Acknowledgments

Getting started


  • Proxmox Virtual Environment 6.1-5
  • Ubuntu 18.04.3 Server


sudo apt-get update
sudo apt-get upgrade

Install qemu-guest-agent

The qemu-guest-agent is a helper daemon, which is installed in the guest. It is used to exchange information between the host and guest, and to execute command in the guest.

In Proxmox VE, the qemu-guest-agent is used for mainly two things:

To properly shutdown the guest, instead of relying on ACPI commands or windows policies To freeze the guest file system when making a backup (on windows, use the volume shadow copy service VSS).

administrator@kms:~$ sudo apt-get install qemu-guest-agent
administrator@kms:~$ sudo shutdown now

In Proxmox, go to Options and Enable by selecting Use QEMU Guest Agent. Start your VM again.

Set your time zone

administrator@kms:~$ date
Sat 11 Jan 21:22:53 GMT 2020
administrator@kms:~$ sudo dpkg-reconfigure tzdata

Current default time zone: 'Europe/Paris'
Local time is now:      Sat Jan 11 22:24:07 CET 2020.
Universal Time is now:  Sat Jan 11 21:24:07 UTC 2020.

administrator@kms:~$ date
Sat 11 Jan 22:24:16 CET 2020

Installing the KMS server

The KMS server is available as binaries or source code that needs to be compiled. Let us use the source code.

administrator@kms:~$ sudo apt-get install git gcc make

git clone the KMS server source code:

administrator@kms:~$ git clone

Compile the source code:

administrator@kms:~$ cd vlmcsd
administrator@kms:~/vlmcsd$ make

Start the KMS daemon

Start the KMS daemon with ./vlmcsd:

administrator@kms:~/vlmcsd$ cd bin/
administrator@kms:~/vlmcsd/bin$ ./vlmcsd 

Using netstat you’ll see that vlmcd is listening on 1688:

administrator@kms:~/vlmcsd/bin$ netstat -a
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0  *               LISTEN  

Test with KMS client

Test the KMS server by running the KMS client:

administrator@kms:~/vlmcsd/bin$ ./vlmcs
Connecting to ... successful
Sending activation request (KMS V6) 1 of 1  -> 1111-12201-369-033755-01-5079-11213.0010-0032021 (4A1DD49C13BB0079)

Configuring the KMS daemon to run at boot

administrator@kms:~/vlmcsd/bin$ sudo nano /etc/systemd/system/kms@administrator.service



You need to reload systemd to make the daemon aware of the new configuration.

administrator@kms:~$ sudo systemctl --system daemon-reload

To have the KMS daemon start automatically at boot, enable the service.

administrator@kms:/etc/systemd/system$ sudo systemctl enable kms@administrator.service
Created symlink /etc/systemd/system/ → /etc/systemd/system/kms@administrator.service.

To disable the automatic start, use this command.

administrator@kms:/etc/systemd/system$ sudo systemctl disable kms@administrator.service 
Removed /etc/systemd/system/

To start the KMS daemon now, use this command (you might get an error if you have not killed the last process of the kms service, when you started it manually):

administrator@kms:/etc/systemd/system$ sudo systemctl start kms@administrator.service 

Use status to see a brief status report as seen below:

administrator@kms:/etc/systemd/system$ sudo systemctl status kms@administrator.service 
● kms@administrator.service - KMS
   Loaded: loaded (/etc/systemd/system/kms@administrator.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Mon 2020-02-03 14:31:21 UTC; 1s ago
  Process: 6491 ExecStart=/home/administrator/vlmcsd/bin/vlmcsd (code=exited, status=0/SUCCESS)
 Main PID: 6491 (code=exited, status=0/SUCCESS)

Feb 03 14:31:21 kms systemd[1]: Started KMS.
administrator@kms:/etc/systemd/system$ ps -ef | grep vlmcsd
adminis+  6363  5391  0 14:29 pts/0    00:00:00 grep --color=auto vlmcsd

Windows configuration

Open up cmd.exe as Administrator:

C:\Windows\system32\> slmgr /skms YOUR_IP_OR_HOSTNAME
C:\Windows\system32\> slmgr /ato

Some more commands

slmgr /upk
slmgr /ato
CD \Program Files\Microsoft Office\Office16 OR CD \Program Files (x86)\Microsoft Office\Office16
cscript ospp.vbs /sethst:YOUR_IP_OR_HOSTNAME
cscript ospp.vbs /inpkey:xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
cscript ospp.vbs /act
cscript ospp.vbs /dstatusall


Mr. Johnson