Changing keyboard layout in Ubuntu Server (Linux, How to)

So I recently installed Ubuntu Server in a virtual machine and I had problems with my keyboard layout. I use UK layout while the default that comes with Ubuntu Server is US layout. As you can imagine, this caused problems and I had to go hunt for a solution. Finally, I found one and here it is:
You need to reconfigure keyboard configuration. Type the following:
sudo dpkg-reconfigure keyboard-configuration