You can start with creating a last.fm account on their site, which is pretty simple. You can add some artists initially for a start.
The next step is to configure your media player for song reporting. This feature is easily present in most Linux media players. You just have to give the media player your last.fm username and password.
Here I'll show you how to configure VLC media player.
- Open VLC media player.
- From menu, Tools > Preferences.
- Select the Audio tab, check the box saying "Enable last.fm submission" and enter your username and password.
That's it! You're done. Now you can play tracks and see your library getting filled automatically, while your player does the job near the end of each track played. Here's my music profile.