When working on Ubuntu Servers, sometimes the defined keyboard layout is not aligned with the physical keyboard one’s using.
In order to permanently change it, just execute the following two commands.
First, configure the keyboard:
sudo dpkg-reconfigure keyboard-configuration
Test the keyboard, in particular the characters like slash, asterisk, etc.. If things are not ok, just configure it again with different options.
Next, configure the console:
sudo dpkg-reconfigure console-setup
And that’s it.
If you want to configure the size of your TTY, i. e. the text console resolution, check ChangeTTYResolution.