Use this guide to get MIDI sound working unless:
you have a soundcard with a linux-supported hardware synth
you are using external MIDI instruments
Most people need to setup MIDI sound using software synthesis.
There are two main programs that do software synthesis, TiMidity++ and Fluidsynth. The installation and setup of TiMidity++ is covered in the majority of this guide, since FluidSynth has a nice GUI for it.
Next you need a set of samples. The easiest way is to install package 'freepats' (a 28 MB download), and you're done. Note that this sample set is incomplete at the moment and doesn't cover the whole General MIDI standard yet.
If you want better sound, add the following repository line to your /etc/apt/sources.list file: