There are plenty of legal alternatives — and plenty of options: including pay-per-song, subscription, and streaming — many are free. Also to note, free doesn't always mean illegal, and not all paid services are legal. It's your job to make sure.
If you still intend to use peer-to-peer or other file sharing software, ensure that it's not configured to automatically share the files on your computer. If configured improperly, malware (viruses), spyware, or identity theft could await you.
Be aware when others use your computer. If the machine connected to the network is registered to you, you'll be the one contacted during an incident.
Learn how peer-to-peer (P2P) software works and how software can be used to pirate music, and then avoid it. This site serves as a great place to start.
Services that provide music legally will not usually have confusing warnings like this one telling you how to use their software legally. Legal sites should also have documentation available proving that their service doesn't violate copyright.
Confirm that the distributor of a file you are interested in downloading has permission from the copyright holder to distribute it. Assume you don't have permission to download or distribute a file unless you have proof to the contrary.
If all else fails, ask — the software company in question, a lawyer, or contact us. We're not lawyers, but we'll give you our best opinion.
Some content adapted from IU.edu © 2009