Updated Solution

Visit http://thelastripper.com and download the application for your system and run perform it all from one simple GUI.

Previous Approach - You will need

Last FM Proxy

Download and uncompress the script

gedit config.py

Add your last.fm username and password between the quotes below.
username = “yourusername”
password = “yourpassword“

Save the file and exit the editor

Run the proxy
./main.py &

Streamripper

To download and install in Ubuntu or Debian just do:

sudo apt-get install streamripper

Start the streamripper program and sit back...

streamripper http://localhost:1881/lastfm.mp3