There's something quite satisfying about spending two and a half days on a slowboat going down the biggest river in the world. The fact that your final destination (Iquitos) is the largest city in the world that isn't reachable by road, and that 99.9% of tourists visiting the city arrive by air, makes it an adventure of epic proportions - especially if, like me, you've dreamed of seeing the Amazon since you were 10 years old.
How to do it? It's pretty easy, especially if you speak some Spanish, though it's not the safest environment for lone, inexperienced travelers.
My recommendation is to set sail from the port of Yurimaguas, in Northern Peru, giving you a 2-3 day voyage down the Huallaga and Maranon rivers to where they join with the Amazon, which then passes right by Iquitos. You can also embark in Pucallpa on a 4-5 day voyage which will take you down the Ucayali river to the Amazon and Iquitos, but I haven't done this route and from what I hear, Pucallpa is a little sketchy at the moment.
Yurimaguas is a very small town - it does have one decent hostel (Hospedaje Carlitos, $7/night, near the docks - ask a mototaxi to take you there) but only a couple of grungy restaurants, not to mention it is one of the hottest places I've been - 110 F during the day, high 80's-90's at night.
Therefore I recommend staying in Tarapoto (easily reachable by bus or plane from Lima or other large cities), and calling ahead to Yurimaguas to find out when a boat is leaving port. Then you can get a ride (two hours) on the same day and avoid an overnight stay in the oven that is Yurimaguas. Stay at Hostal Misti in Tarapoto ($7/night for a private room with a fan), whose friendly owner can call the share taxis that make the run to Yurimaguas to come and pick you up from the hostel at no extra charge (fare is $10, the only way to get there unless you hitch).
The best and cleanest boats doing the Yurimaguas-Iquitos run are operated by Transportes Eduardo. They have six boats and therefore one of them is in Yurimaguas most days. Call their office from Tarapoto (Phone: 065 351270) to find out when the next boat leaves and make a reservation - you'll need to speak Spanish. You have two options: for $10 you can sling your hammock (you supply the hammock) on the deck, or for $100 you can get a private cabin with two beds and a bathroom with a shower. Prices include meals, served by the galley, but you must bring your own drinking water. If you're traveling in a large group, by all means, sling a hammock on the deck and enjoy - you might want to post a guard over your belongings at all times as you will be sharing the deck with a couple hundred other passengers. If you're traveling solo or in a small group, consider going for the cabin so that you have somewhere to lock up your gear so that you can roam the ship freely - this option also saves you from using the communal bathroom.
When you arrive in Yurimaguas in the share-taxi, ask a local mototaxi to take you to the docks (actually just a muddy riverbank where boats beach to unload cargo) and board the Eduardo boat. Look around for the clerk, who should have your reservation under your name if you made one and will point you to your hammock deck or show you to your cabin. You're on your way! Make SURE you have enough drinking water for the voyage.
The ride itself is an experience - you can watch from the upper deck as the boat beaches at local villages to trade city items such as soda and gasoline for bushels of plantains and livestock. Dugout canoes will dart out from shore and tie on to the boat in order to make their trades while the cargo boat doesn't even slow down. You'll see endless jungle on both riverbanks, and if you're lucky, you might spot some pink river dolphins.
In Iquitos you have but to walk of the boat and grab a mototaxi to the city center, where hostels abound. Enjoy!