Note: The following instructions are out of date. Please see this thread: https://discourse.suttacentral.net/t/insert-pali-and-sanskrit-characters-with-diacritical-marks-on-discourse-and-operating-systems/311/
A few years ago Galia Shy (Mahacitta) designed a method for easily inserting Pali/Sanskrit special characters in Ubuntu. Since then Ubuntu has changed a few things, and the old instructions do not work. I have revised the instructions to work with a fresh install of Ubuntu 12.10. (It may work with 12.04, but I haven’t tested it).
You can download the file and instructions from here.
Let me know if this works for you. Needless to say, no guarantees!