If you didn’t choose your keyboard layout correctly at installation time you can still make it work right. On Debian you can do so as follow:
This will show up a ncurses tool that allows you choose among keyboard, layouts and options:
In the end this application writes the /etc/default/keyboard file, which is read by HAL and X, for the console and graphic setup. If you want to apply changes you must restart HAL.
Setting console keyboard
An alternative for setting the console keyboard layout is to use the console-data package as we saw previously.