In Ubuntu 8.04 (Hardy), go to System--> Administration--> Language Support and install Spanish. This requires a reboot. Truth be told, I'm not sure you have to do this step just to get the keyboard layout, but if you type enough in a language that you want the keyboard layout, you probably want the rest of the language support as well.
To install control over the keyboard layout:
- Right-click on the top panel (aka menu bar, aka tool bar) and select "Add to Panel..."
- Select "Keyboard Indicator". You'll see the indicator appear in the panel. In my case, it said "USA"
- Right click on the indicator and select "Keyboard Preferences"
- Select the "Layouts" tab
- Click the "Add..." button
- Select the keyboard layout you want. For those looking for Spanish, note that there's a layout for Spain and a layout called "Latin American". The keyboard I bought in Guatemala is actually the "Spanish" layout. You'll have to figure out what works for you
- Click OK until you're back to what you wanted to be doing