Here is my method that I know works. If you have a better one feel free to post it in the comments section. It may not produce the best quality audio but I’m sure it can be improved.

Obtain a 3.5mm to 3.5mm audio cable, for example this one. Connect one end to the audio source (for example a PC) and the other end to the microphone in on your linux box (I tried line in but that didn’t work for some reason).

Make sure ALSA utilities and ffmpeg are installed (at a console prompt):

$ sudo apt-get install alsa-utils ffpmeg

Start recording with:

$ arecord -f cd -t wav test.wav

Start the audio source and once complete press Ctrl-C to stop recording. Convert to MP3 with:

$ ffmpeg -b 128k -i test.wav test.mp3

I then run the file through MP3Gain as the recordings tend to be a bit quiet and add tags in iTunes.