Yes, and it is quite easy. This is for Ubuntu 12.04LTS but should work similarly on other systems.
Step 1. Designate a keyboard key as the compose key. For example.
Set “System Settings … -> Keyboard Layout -> Options… -> Compose Key Position to Right Alt” as compose key to type in diacritics.
Step 2. Enter special characters as needed:
For instance, from the link mentioned above:
Press compose then ' then a letter to place an acute accent over that letter, such as é.
Press compose then ` (back tick) then a letter to place a grave accent over that letter, such as è.
Press compose then " then a letter to place an umlaut over that letter, such as ë.
Press compose then - then a letter to place a macron over that letter, such as ē.
Perhaps the tricky one which is not mentioned on the site, which is required to
in order to write proper Czech, is ů. To type this letter, the combination is
Compose Key + * + u.
For capital letters, for instance Š, you can type Compose, then ", then SHIFT+S.
This covers the complete set of required characters for Czech language input
using a plain ASCII keyboard.