How to remap CapsLock to Esc key in Ubuntu installed on VPS (console only, no Desktop Environment)?

The goal is to remap CapsLock to Esc key in my Ubuntu 20.04 remote server (console only, no Desktop Environment).

This Ubuntu system is installed on Virtual Private Server. I'm logging to this server using Putty, from my home laptop with Windows 10.

And everybody are talking about mapping this CapsLock key to Esc, but I was unable to find actual line, that needs 2 be written.

I've run this:

michal@localhost:~$ localectl status
   System Locale: LANG=en_US.UTF-8
       VC Keymap: n/a
      X11 Layout: us
       X11 Model: pc105

but I don't understand what VC Keymap means?

Should there be something other than n/a?

I've also tried creating /etc/vconsole.conf file and I've added a line there:

keycode 58 = Escape

but it changes nothing. Yes - I've rebooted my Ubuntu server.

I've read this help page:

but it's little to complicated 4 me, and I simply cannot extract the solution from there.


Try to edit /etc/default/keyboard and include the line:

XKBOPTIONS="caps:escape"